From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
To: Shriramana Sharma <jamadagni@gmail.com>
Cc: Linux C Programming List <linux-c-programming@vger.kernel.org>
Subject: Re: why right-to-left evaluation in printf argument list?
Date: Fri, 25 May 2007 18:43:23 +0200 [thread overview]
Message-ID: <200705251843.28432.m.kozlowski@tuxland.pl> (raw)
In-Reply-To: <46551469.4080103@gmail.com>
Hello,
> For you people this is probably old hat but none of my book sources
> explain the C / C++ idiosyncrasy of evaluating arguments of printf (and
> maybe other functions too, I don't know) from right-to-left. For
> instance, the following code:
>
> # include <stdio.h>
> void main ( void )
> {
> int i = 0 ;
> printf ( "%d %d\n", i ++, i ++ ) ;
> }
>
> prints out:
>
> 1 0
>
> instead of:
>
> 0 1
>
> as expected. I remember having heard of this years ago and got around to
> testing it today, but I don't get the logic behind this behaviour. Is
> there one? If yes, what is it?
Take a look here -> http://www.c-faq.com/expr/comma.html
Regards,
Mariusz
next prev parent reply other threads:[~2007-05-25 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 4:28 why right-to-left evaluation in printf argument list? Shriramana Sharma
2007-05-25 16:43 ` Mariusz Kozlowski [this message]
2007-05-25 22:54 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200705251843.28432.m.kozlowski@tuxland.pl \
--to=m.kozlowski@tuxland.pl \
--cc=jamadagni@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).