tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] main does not returns 0 by default (at least on Windo


From: Christian Jullien
Subject: Re: [Tinycc-devel] main does not returns 0 by default (at least on Windows)
Date: Thu, 23 Nov 2017 07:13:56 +0100

After checking again, this section actually comes from ISO/IEC 9899:1999 (E). 
ISO/IEC 9899:1990 (E) only says that result is unspecified.

So tcc is compatible with C90, i.e. undefined. Which is correct since it 
pretends itself tcc_define_symbol(s, "__STDC_VERSION__", "199901L");)

Three reasons to make it C99 compatible:
- It behaves differently from Visual C and gcc
- C90 is quite old and tcc looks to want to support more C99 and even C11 
features.
- Wikipedia page claims it supports much of the C99 ISO standard, see 
https://en.wikipedia.org/wiki/Tiny_C_Compiler

Btw, I added a TinyCC link to https://en.wikipedia.org/wiki/ANSI_C

C.

-----Original Message-----
From: Edmund Grimley Evans [mailto:address@hidden 
Sent: mercredi 22 novembre 2017 14:20
To: Christian JULLIEN
Subject: Re: [Tinycc-devel] main does not returns 0 by default (at least on 
Windows)

> Testing mob on Windows, I see that tcc is not C90 compliant on default 
> return type :
>
>
>
> From C90 :
>
>
>
>        5.1.2.2.3  Program termination
>
>
>
>        [#1] If the return type of  the  main  function  is  a  type
>
>        compatible  with  int, a return from the initial call to the
>
>        main function is equivalent to  calling  the  exit  function
>
>        with  the  value  returned  by  the  main  function  as  its
>
>        argument;10)   reaching  the  }  that  terminates  the  main
>
>        function returns a value of 0.

Are you sure you're quoting C90 there and not C99?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]