void main

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

void main

Jochen Wilhelmy
Hi!

when I have a void main() I get this error:
'main' must return 'int'.

Is it possible to disable this? Of course it should be enabled by default
but for me it would be better if it can be disabled.

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: void main

Jochen Wilhelmy

> That's entirely non-standard. Why not just return 0?
>  
I'm not using clang for standard purposes. Just as an embedded compiler.
If you have for example glsl they define void main() as the main entry
point (nehe.gamedev.net/data/articles/article.asp?article=21).

I want to do a similar thing and therefore want to switch off all
magic that is associated with main.

I already found

if (NewFD->isMain())
    CheckMain(NewFD);

In SemaDecl.cpp. I only need to find where the isMain property gets
set.

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: void main

Jochen Wilhelmy
In reply to this post by Jochen Wilhelmy
that's great: I only have to do
langOptions.Freestanding = 1;

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev