Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #22493 > unrolled thread

Pre And Post Increment Operator Output

Started byYogesh Yadav Pacheria <yogeshpacheria@gmail.com>
First post2012-06-21 12:56 -0700
Last post2012-06-22 12:18 +0100
Articles 10 on this page of 50 — 23 participants

Back to article view | Back to comp.lang.c


Contents

  Pre And Post Increment Operator Output Yogesh Yadav Pacheria <yogeshpacheria@gmail.com> - 2012-06-21 12:56 -0700
    Re: Pre And Post Increment Operator Output Paul N <gw7rib@aol.com> - 2012-06-21 13:08 -0700
      Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-21 16:52 -0400
    Re: Pre And Post Increment Operator Output John Gordon <gordon@panix.com> - 2012-06-21 20:11 +0000
    Re: Pre And Post Increment Operator Output Andrew Cooper <amc96@cam.ac.uk> - 2012-06-21 21:29 +0100
    Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-21 22:08 +0100
      Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-21 17:32 -0400
        Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-22 00:00 +0100
          Re: Pre And Post Increment Operator Output Keith Thompson <kst-u@mib.org> - 2012-06-21 16:51 -0700
            Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-22 11:09 +0100
              Re: Pre And Post Increment Operator Output nick_keighley_nospam@hotmail.com - 2012-06-22 05:36 -0700
              Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-22 14:34 +0100
                Re: Pre And Post Increment Operator Output Les Cargill <lcargill99@comcast.com> - 2012-06-22 12:45 -0500
                Re: Pre And Post Increment Operator Output nick_keighley_nospam@hotmail.com - 2012-06-25 00:27 -0700
                  Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-25 14:32 +0100
                  Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-25 09:42 -0400
                    Re: Pre And Post Increment Operator Output Kenneth Brody <kenbrody@spamcop.net> - 2012-06-25 11:33 -0400
                Re: Pre And Post Increment Operator Output Richard Damon <news.x.richarddamon@xoxy.net> - 2012-07-04 16:27 -0400
                  Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-04 17:46 -0400
                    Re: Pre And Post Increment Operator Output Richard Damon <news.x.richarddamon@xoxy.net> - 2012-07-05 09:08 -0400
                    Re: Pre And Post Increment Operator Output "io_x" <a@b.c.invalid> - 2012-07-06 17:34 +0200
              Re: Pre And Post Increment Operator Output Keith Thompson <kst-u@mib.org> - 2012-06-22 12:31 -0700
                Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-22 16:21 -0400
          Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-21 21:06 -0400
            Re: Pre And Post Increment Operator Output Noob <root@127.0.0.1> - 2012-06-22 13:30 +0200
              Re: BartC (was: Pre And Post Increment Operator Output) "BartC" <bc@freeuk.com> - 2012-06-22 13:06 +0100
              Re: Pre And Post Increment Operator Output Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-22 09:26 -0400
                Re: Pre And Post Increment Operator Output "Bartc" <bc@freeuk.com> - 2012-07-01 16:33 +0100
                  Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-01 17:15 +0100
                    Re: Pre And Post Increment Operator Output "Bartc" <bc@freeuk.com> - 2012-07-01 18:45 +0100
                      Re: Pre And Post Increment Operator Output Keith Thompson <kst-u@mib.org> - 2012-07-01 13:03 -0700
                      Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-02 00:18 +0100
          Re: Pre And Post Increment Operator Output Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-24 23:45 +0300
        Re: Pre And Post Increment Operator Output Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-24 09:15 -0700
          Re: Pre And Post Increment Operator Output Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-24 23:54 +0300
            Re: Pre And Post Increment Operator Output Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-24 15:12 -0700
              Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-25 11:00 +0100
                Re: Pre And Post Increment Operator Output Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-25 13:53 -0700
    Re: Pre And Post Increment Operator Output Keith Thompson <kst-u@mib.org> - 2012-06-21 15:17 -0700
    Re: Pre And Post Increment Operator Output Yogesh Yadav Pacheria <yogeshpacheria@gmail.com> - 2012-06-21 21:03 -0700
      Re: Pre And Post Increment Operator Output nick_keighley_nospam@hotmail.com - 2012-06-22 00:06 -0700
      Re: Pre And Post Increment Operator Output Mark Bluemel <mark_bluemel@pobox.com> - 2012-06-22 08:30 +0100
      Re: Pre And Post Increment Operator Output John Bode <jfbode1029@gmail.com> - 2012-06-22 09:18 -0700
        Re: Pre And Post Increment Operator Output Keith Thompson <kst-u@mib.org> - 2012-06-22 12:36 -0700
        Re: Pre And Post Increment Operator Output lawrence.jones@siemens.com - 2012-06-22 14:25 -0400
    Re: Pre And Post Increment Operator Output "Heinrich Wolf" <invalid@invalid.invalid> - 2012-06-22 10:27 +0200
      Re: Pre And Post Increment Operator Output Kenneth Brody <kenbrody@spamcop.net> - 2012-06-22 13:46 -0400
        Re: Pre And Post Increment Operator Output Michael Press <rubrum@pacbell.net> - 2012-07-13 02:09 -0700
    Re: Pre And Post Increment Operator Output Ian Collins <ian-news@hotmail.com> - 2012-06-22 23:11 +1200
      Re: Pre And Post Increment Operator Output Mark Bluemel <mark_bluemel@pobox.com> - 2012-06-22 12:18 +0100

Page 3 of 3 — ← Prev page 1 2 [3]


#22516

Fromnick_keighley_nospam@hotmail.com
Date2012-06-22 00:06 -0700
Message-ID<a5608b29-ad2c-4849-91e1-0579dbb9632d@googlegroups.com>
In reply to#22514
On Friday, June 22, 2012 5:03:42 AM UTC+1, Yogesh Yadav Pacheria wrote:

> I am new to see and wanna learn it deeply
> 
> Could u guyz tell me some good books or web links

"The C Programming Language" Kernighan and Ritchie (known as K&R).

[toc] | [prev] | [next] | [standalone]


#22520

FromMark Bluemel <mark_bluemel@pobox.com>
Date2012-06-22 08:30 +0100
Message-ID<js16un$sge$1@speranza.aioe.org>
In reply to#22514
On 22/06/2012 05:03, Yogesh Yadav Pacheria wrote:
> I am new to see and wanna learn it deeply

Hmmm... And your first question to the group consists of a rather 
convoluted and contrived example of pre- and post- increments.

> Could u guyz tell me some good books or web links

If you're serious (and I have some doubts) section 18 of the FAQ 
(http://c-faq.com) has pointers to some resources.

[toc] | [prev] | [next] | [standalone]


#22543

FromJohn Bode <jfbode1029@gmail.com>
Date2012-06-22 09:18 -0700
Message-ID<10b9b909-e864-4be6-9692-e88c39bf5ef2@googlegroups.com>
In reply to#22514
On Thursday, June 21, 2012 11:03:42 PM UTC-5, Yogesh Yadav Pacheria wrote:
> I am new to see and wanna learn it deeply
> 
> Could u guyz tell me some good books or web links

For *learning* C:

 - "The C Programming Language", Kernighan & Ritchie, 2nd ed.  
   While a bit  out of date (doesn't cover anything after the 
   C89 standard), it's still one of the best general introductions 
   to the language.  
 
 - "C Programming: A Modern Approach", K.N. King, 2nd ed.  While
   I don't have any direct experience with this book, people I
   trust recommend it highly.

For *working* in C:

 - "C: A Reference Manual", Harbison & Steele, 5th ed.  My go-to 
   reference starting with the 2nd edition in the 1980s.  Not the 
   greatest *learning* resource, but invaluable to have at your 
   side when you're trying to remember how something works.  

The Language Standard:

 - A publicly available draft of the 2011 standard is available
   at the link below:

   http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1539.pdf

   This isn't the final, official version, but it's close enough 
   most practical purposes.  Again, not a great *learning* resource,
   but invaluable to have handy.  

[toc] | [prev] | [next] | [standalone]


#22556

FromKeith Thompson <kst-u@mib.org>
Date2012-06-22 12:36 -0700
Message-ID<lna9zv87gh.fsf@nuthaus.mib.org>
In reply to#22543
John Bode <jfbode1029@gmail.com> writes:
[...]
> The Language Standard:
>
>  - A publicly available draft of the 2011 standard is available
>    at the link below:
>
>    http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1539.pdf
>
>    This isn't the final, official version, but it's close enough 
>    most practical purposes.  Again, not a great *learning* resource,
>    but invaluable to have handy.  

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf is more
current, and the actual 2011 ANSI C standard is available for $30 from
ANSI at:

http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+9899-2012

<OT>The 2011 C++ standard is also available.</OT>

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#22557

Fromlawrence.jones@siemens.com
Date2012-06-22 14:25 -0400
Message-ID<7tpeb9-359.ln1@jones.homeip.net>
In reply to#22543
John Bode <jfbode1029@gmail.com> wrote:
> 
>  - A publicly available draft of the 2011 standard is available
>    at the link below:
> 
>    http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1539.pdf
> 
>    This isn't the final, official version, but it's close enough 
>    most practical purposes.  Again, not a great *learning* resource,
>    but invaluable to have handy.  

Even closer is N1570, which is identical to the official version except
for the headers/footers and the addition of diff marks indicating
changes from N1539.
-- 
Larry Jones

I don't see why some people even HAVE cars. -- Calvin

[toc] | [prev] | [next] | [standalone]


#22525

From"Heinrich Wolf" <invalid@invalid.invalid>
Date2012-06-22 10:27 +0200
Message-ID<js1aa4$nbu$1@news.m-online.net>
In reply to#22493
"Yogesh Yadav Pacheria" <yogeshpacheria@gmail.com> schrieb im Newsbeitrag 
news:8404c4f1-a3b7-46b7-ad9c-17de265f9aee@googlegroups.com...
>I tried this Code
>
> int main()
> {
>   int i = 0;
>   i = ++i + ++i + ++i;
>   printf("%d",i);
> }
>
> Output should be 6
>
> But In GCC it's 7
>
> How and plz tell the order of evalution of pre and post bot
>
> Thanks in Advance

Hi,

I find it unreasonable to use such code in serious projects.
My old Turbo C 2.0 prints 9 and so does my Borland C++ Builder 5.
I do not care why.

kind regards
Heiner 

[toc] | [prev] | [next] | [standalone]


#22550

FromKenneth Brody <kenbrody@spamcop.net>
Date2012-06-22 13:46 -0400
Message-ID<fe2dnYuaHIv7MnnSnZ2dnUVZ_vKdnZ2d@bestweb.net>
In reply to#22525
On 6/22/2012 4:27 AM, Heinrich Wolf wrote:
> "Yogesh Yadav Pacheria" <yogeshpacheria@gmail.com> schrieb im Newsbeitrag
> news:8404c4f1-a3b7-46b7-ad9c-17de265f9aee@googlegroups.com...
>> I tried this Code
>>
>> int main()
>> {
>>   int i = 0;
>>   i = ++i + ++i + ++i;
>>   printf("%d",i);
>> }
[...]
> I find it unreasonable to use such code in serious projects.

Even "not serious" projects.  Unless the purpose of the project is to see 
how different compilers handle particular UB scenarios.

> My old Turbo C 2.0 prints 9 and so does my Borland C++ Builder 5.

Probably because it did all 3 pre-increments before doing any of the 
additions.  (Which is a perfectly reasonable and "legal" approach to the 
statement at hand.)

 > I do not care why.

"Because printing '9' is one of an infinite possible results."

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#23275

FromMichael Press <rubrum@pacbell.net>
Date2012-07-13 02:09 -0700
Message-ID<rubrum-F61516.02093913072012@news.albasani.net>
In reply to#22550
In article <fe2dnYuaHIv7MnnSnZ2dnUVZ_vKdnZ2d@bestweb.net>,
 Kenneth Brody <kenbrody@spamcop.net> wrote:

> "Because printing '9' is one of an infinite possible results."

Whomever you quote is incoherent, and incorrect
if a charitable reading is given to him.

-- 
Michael Press

[toc] | [prev] | [next] | [standalone]


#22530

FromIan Collins <ian-news@hotmail.com>
Date2012-06-22 23:11 +1200
Message-ID<a4j276FglkU2@mid.individual.net>
In reply to#22493
On 06/22/12 07:56 AM, Yogesh Yadav Pacheria wrote:
> I tried this Code
>
> int main()
> {
>     int i = 0;
>     i = ++i + ++i + ++i;
>     printf("%d",i);
> }
>
> Output should be 6
>
> But In GCC it's 7
>
> How and plz tell the order of evalution of pre and post bot
>
> Thanks in Advance

Is this question auto-generated by a cron job somewhere?

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#22531

FromMark Bluemel <mark_bluemel@pobox.com>
Date2012-06-22 12:18 +0100
Message-ID<js1ka5$tvu$1@speranza.aioe.org>
In reply to#22530
On 22/06/2012 12:11, Ian Collins wrote:
> On 06/22/12 07:56 AM, Yogesh Yadav Pacheria wrote:
>> I tried this Code
>>
>> int main()
>> {
>>     int i = 0;
>>     i = ++i + ++i + ++i;
>>     printf("%d",i);
>> }
>>
>> Output should be 6
>>
>> But In GCC it's 7
>>
>> How and plz tell the order of evalution of pre and post bot
>>
>> Thanks in Advance
>
> Is this question auto-generated by a cron job somewhere?

With a set of Lex scripts to generate varying English syntax? I note 
that the Jive/Valley Girl/Swedish Chef/Pig Latin translator is available 
on the web - someone must have a txtspk version...

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.c


csiph-web