On Fri 2008-03-21 22:19:54 UTC-0700, Mukul Trivedi ([EMAIL PROTECTED]) wrote:
> in c if i don't write return type of function compiler doesn't show error why?
Which compiler?
It will show a warning in GCC and MSVC, if you use the correct
compiler switches.
18:24 [EMAIL PROTECTED] [~/src/test]cat test.c
myfunc(void)
{
}
18:24 [EMAIL PROTECTED] [~/src/test]gcc -W -Wall -c test.c
test.c:2: warning: return type defaults to int'
test.c: In function myfunc':
test.c:2: warning: control reaches end of non-void function
18:25 hax [C:\devel\src\test]type test.c
myfunc(void)
{
}
18:25 hax [C:\devel\src\test]cl -W4 -c test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.c
test.c(2) : warning C4431: missing type specifier - int assumed. Note: C no
longer supports default-int