From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Comment: RFC 2476 MSA function at mx18.yandex.ru logged sender identity as: shader Message-ID: <43044D8C.6000204@yandex.ru> Date: Thu, 18 Aug 2005 12:57:48 +0400 From: "Alexey V. Novikov" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: ru-ru, ru MIME-Version: 1.0 To: ALT Linux Community Subject: Re: [Comm] [JT] C function parameters order References: <43044893.3000909@vzljot.ru> In-Reply-To: <43044893.3000909@vzljot.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Linux Community List-Id: ALT Linux Community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2005 08:58:44 -0000 Archived-At: List-Archive: List-Post: 18.08.2005 12:36, Vitaly Ostanin пишет: > Здравствуйте. > > Тут прислали прикол: > #include > 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