tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] main does not returns 0 by default (at least on Windows)


From: Christian Jullien
Subject: [Tinycc-devel] main does not returns 0 by default (at least on Windows)
Date: Fri, 13 Oct 2017 06:57:01 +0200

Hi all,

 

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.

 

F:\tinycc\W>more foo.c

#include <stdio.h>

 

int

main()

{

        printf("ptr size: %d\n", sizeof(void*));

/*

        This should be implicit.

        return 0;

*/

}

 

F:\tinycc\W>gcc foo.c -o foo.exe

 

F:\tinycc\W>foo && echo Ok

ptr size: 8

Ok

 

F:\tinycc\W>tcc foo.c -o foo.exe && foo && echo Ok

ptr size: 8

 

Ok not echoed!

Both cl and gcc work like that.

 

(OLD) Christian


reply via email to

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