Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Implementat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 36 of 57 Topic 25153 of 28234
Post > Topic >>

Re: Implementation-defined behaviour

by Ioannis Vranos <ivranos@[EMAIL PROTECTED] > Mar 28, 2008 at 06:58 PM

Dann Corbit wrote:
> 
> --- Module:   foo.c (C)
>                             _
>     printf("%d %d\n", n++, n);
> foo.c(8) : Warning 564: variable 'n' depends on order of evaluation

I wonder a bit about this one. Let's consider a simpler version:


#include <stdio.h>


int somefunc(int x)
{
	printf("%d\n", x);
	
	return x;
}


int main(void)
{
	int x= 1;
	
	somefunc(x++);	
	
	return 0;
}



Above, is it well defined that it will be printed "1"?



#include <stdio.h>


int somefunc(int x)
{
	printf("%d\n", x);
	
	return x;
}


int main(void)
{
	int x= 1;
	
	somefunc( (x++, somefunc(x)) );	
	
	return 0;
}


In the above, the expression (x++, somefunc(x)) is evaluated to 2, so I
assume it is guaranteed that it will print "2".
 




 57 Posts in Topic:
Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 04:03:59 
Re: Implementation-defined behaviour
santosh <santosh.k83@[  2008-03-28 07:36:46 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 04:14:48 
Re: Implementation-defined behaviour
santosh <santosh.k83@[  2008-03-28 07:52:41 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 17:02:47 
Re: Implementation-defined behaviour
Eric Sosman <esosman@[  2008-03-27 22:14:21 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 04:18:42 
Re: Implementation-defined behaviour
Ian Collins <ian-news@  2008-03-28 15:35:48 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 05:18:31 
Re: Implementation-defined behaviour
"Dann Corbit" &  2008-03-27 20:21:13 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 16:58:36 
Re: Implementation-defined behaviour
Andrey Tarasevich <and  2008-03-27 20:22:04 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 14:20:38 
Re: Implementation-defined behaviour
richard@[EMAIL PROTECTED]  2008-03-28 12:30:20 
Re: Implementation-defined behaviour
Antoninus Twink <nospa  2008-03-28 14:29:17 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 16:44:12 
Re: Implementation-defined behaviour
CBFalconer <cbfalconer  2008-03-28 19:39:42 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 20:25:48 
Re: Implementation-defined behaviour
"Stephen Sprunk"  2008-03-29 18:02:23 
Re: Implementation-defined behaviour
Barry Schwarz <schwarz  2008-03-27 22:23:54 
Re: Implementation-defined behaviour
Philip Potter <pgp@[EM  2008-03-28 09:17:56 
Re: Implementation-defined behaviour
Antoninus Twink <nospa  2008-03-28 14:28:23 
Re: Implementation-defined behaviour
jacob navia <jacob@[EM  2008-03-28 14:57:40 
Re: Implementation-defined behaviour
gazelle@[EMAIL PROTECTED]  2008-03-28 14:23:12 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 16:51:32 
Re: Implementation-defined behaviour
Eric Sosman <esosman@[  2008-03-28 08:35:04 
Re: Implementation-defined behaviour
richard@[EMAIL PROTECTED]  2008-03-28 12:49:58 
Re: Implementation-defined behaviour
Eric Sosman <Eric.Sosm  2008-03-28 10:50:24 
Re: Implementation-defined behaviour
"Dann Corbit" &  2008-03-27 20:19:35 
Re: Implementation-defined behaviour
Barry Schwarz <schwarz  2008-03-27 22:27:34 
Re: Implementation-defined behaviour
"Dann Corbit" &  2008-03-28 00:06:15 
Re: Implementation-defined behaviour
Richard Heathfield <rj  2008-03-28 07:22:08 
Re: Implementation-defined behaviour
"Dann Corbit" &  2008-03-28 00:37:01 
Re: Implementation-defined behaviour
Richard Heathfield <rj  2008-03-28 08:02:22 
Re: Implementation-defined behaviour
"Dann Corbit" &  2008-03-28 01:03:18 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-28 18:58:09 
Re: Implementation-defined behaviour
CBFalconer <cbfalconer  2008-03-28 15:43:45 
Re: Implementation-defined behaviour
Keith Thompson <kst-u@  2008-03-28 19:56:55 
Re: Implementation-defined behaviour
"Herbert Rosenau&quo  2008-03-29 20:10:23 
Re: Implementation-defined behaviour
Willem <willem@[EMAIL   2008-03-29 20:35:44 
Re: Implementation-defined behaviour
lawrence.jones@[EMAIL PRO  2008-03-29 17:10:46 
Re: Implementation-defined behaviour
"Stephen Sprunk"  2008-03-29 18:14:49 
Re: Implementation-defined behaviour
Richard <devr_@[EMAIL   2008-03-28 16:36:53 
Re: Implementation-defined behaviour
gazelle@[EMAIL PROTECTED]  2008-03-28 16:10:32 
Re: Implementation-defined behaviour
Richard <devr_@[EMAIL   2008-03-28 17:56:07 
Re: Implementation-defined behaviour
Richard <devr_@[EMAIL   2008-03-28 18:16:13 
Re: Implementation-defined behaviour
Ben Bacarisse <ben.use  2008-03-28 17:37:46 
Re: Implementation-defined behaviour
"Herbert Rosenau&quo  2008-03-29 20:10:23 
Re: Implementation-defined behaviour
Ioannis Vranos <ivrano  2008-03-29 22:16:27 
Re: Implementation-defined behaviour
Ben Bacarisse <ben.use  2008-03-29 21:50:19 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 16:54:38 
Re: Implementation-defined behaviour
Harald van =?UTF-8?b?RMSz  2008-03-28 22:56:39 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-28 20:27:09 
Re: Implementation-defined behaviour
Flash Gordon <spam@[EM  2008-03-29 08:10:44 
Re: Implementation-defined behaviour
Harald van =?UTF-8?b?RMSz  2008-03-29 08:05:51 
Re: Implementation-defined behaviour
Harald van =?UTF-8?b?RMSz  2008-03-29 12:57:39 
Re: Implementation-defined behaviour
pete <pfiland@[EMAIL P  2008-03-29 19:51:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 19:18:59 CST 2008.