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 29 of 57 Topic 25153 of 28234
Post > Topic >>

Re: Implementation-defined behaviour

by "Dann Corbit" <dcorbit@[EMAIL PROTECTED] > Mar 27, 2008 at 08:19 PM

"Ioannis Vranos" <ivranos@[EMAIL PROTECTED]
> wrote in message 
news:fshjmg$1avp$1@[EMAIL PROTECTED]
> AFAIK the following is implementation-defined behaviour, am I right?:
>
>
> #include <stdio.h>
>
>
> int main(void)
> {
> int n= 0;
>
> printf("%d\n", n++);
>
>
> return 0;
> }

C:\tmp>lin foo.c

C:\tmp>"C:\Lint\Lint-nt"  +v  -i"C:\Lint"  std.lnt  -os(_LINT.TMP) foo.c
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006

--- Module:   foo.c (C)

C:\tmp>type _LINT.TMP   | more

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

---
 output placed in _LINT.TMP

C:\tmp>splint foo.c
Splint 3.1.1 --- 12 Mar 2007

foo.c: (in function main)
foo.c(8,24): Argument 2 modifies n, used by argument 3 (order of
evaluation 
of
                actual parameters is undefined): printf("%d %d\n", n++, n)
  Code has unspecified behavior. Order of evaluation of function
parameters 
or
  subexpressions is not defined, so if a value is used and modified in
  different places not separated by a sequence point constraining
evaluation
  order, then the result of the expression is unspecified. (Use -evalorder

to
  inhibit warning)

Finished checking --- 1 code warning

C:\tmp>type foo.c
#include <stdio.h>
int             main(void)
{
    int             n = 0;
    /* Not a problem, function call is a sequence point: */
    printf("%d\n", n++);
    /* Problem here, order unspecified */
    printf("%d %d\n", n++, n);
    return 0;
}



-- 
Posted via a free Usenet account from http://www.teranews.com
 




 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:23:07 CST 2008.