From: "Alexey V. Novikov" <shader@yandex.ru>
To: ALT Linux Community <community@altlinux.ru>
Subject: Re: [Comm] [JT] C function parameters order
Date: Thu, 18 Aug 2005 12:57:48 +0400
Message-ID: <43044D8C.6000204@yandex.ru> (raw)
In-Reply-To: <43044893.3000909@vzljot.ru>
18.08.2005 12:36, Vitaly Ostanin пишет:
> Здравствуйте.
>
> Тут прислали прикол:
> #include <stdio.h>
> void test(int a, int b, int c, int d)
> {
> printf("a=%d, b=%d, c=%d, d=%d\n", a ,b, c, d);
> }
> void main(void)
> {
> int c = 1;
> test(++c, ++c, ++c, ++c);
> test(c++, c++, c++, c++);
> printf("\nc=%d\n", c);
> }
>
> gcc-3.4.4 и борландовский turbo C 2.0.1 говорят:
> a=5, b=4, c=3, d=2
> a=8, b=7, c=6, d=5
>
> c=9
>
> А MS visual C 6.0 говорит:
> a=5, b=4, c=3, d=2
> a=5, b=5, c=5, d=5
>
> c=9
>
> Кто из них не прав?
А если вот так (MinGW GCC 3.3.1 (mingw special 20030804-1))
gcc -o main.exe -O3 main.c, то имеем:
a=2, b=3, c=4, d=5
a=5, b=6, c=7, d=8
c=9
:)
--
WBR, Alexey V. Novikov
next prev parent reply other threads:[~2005-08-18 8:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-18 8:36 Vitaly Ostanin
2005-08-18 8:53 ` Andrew Borodin
2005-08-18 9:22 ` [Comm] " Vitaly Ostanin
2005-08-18 8:57 ` Alexey V. Novikov [this message]
2005-08-18 8:59 ` [Comm] " Damir Shayhutdinov
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=43044D8C.6000204@yandex.ru \
--to=shader@yandex.ru \
--cc=community@altlinux.ru \
/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
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git