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


Groups > comp.std.c > #6417

Is the output of this program compiler dependent?

From Satan <satan@dot.com>
Newsgroups comp.std.c
Subject Is the output of this program compiler dependent?
Date 2022-01-17 03:00 +0000
Organization Aioe.org NNTP Server
Message-ID <ss2nci$a2k$1@gioia.aioe.org> (permalink)

Show all headers | View raw


I read somewhere that the parameters of functions are evaluated right >> 
to left but it all depends on the compiler. Therefore, does this mean 
that the output of this program is "undefined" meaning there is no 
definite answer!

#include <stdio.h>

void fun(int, int);

int main()
{
     int i = 5;
     fun(--i, i++);
     fun(++i, i--);
     printf("From Main: %d\n", i++);

     return 0;
}

void fun(int x, int y)
{
     printf("From Function: %d  %d\n", x++, y--);
}

Back to comp.std.c | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Is the output of this program compiler dependent? Satan <satan@dot.com> - 2022-01-17 03:00 +0000
  Re: Is the output of this program compiler dependent? Richard Damon <Richard@Damon-Family.org> - 2022-01-16 23:18 -0500

csiph-web