insertCode:main() { } return(0);
insertCode:main() { } return(0);
i think you will receive a error, because return MUST TO BE IN A FUNCTION BODY!
why don't you try it and find out for yourself?
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
Sort of the same thing that happens when you ask the air a question, except your annoying friend (who has all the cool stuff at his house) the compiler hears your question and answers instead.
It will not be an error if you include the following before your main function
Code:#define return(...)
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
Hmm...I'm not sure about that. It seems that it's semi-illegal in C++: macros - C++ preprocessor #define-ing a keyword. Is it standards conforming? - Stack Overflow.
In C99/C11, section 6.10.3 seems to be the right place to look, and I did a decent scan but I don't have time for a very thorough reading. However, I couldn't find anything in the standard that forbids it, or says it results in undefined behavior. I did find this Macros - The C Preprocessor. Far from authoritative, but suggestive at least that it's allowed.
Feel free to point out anything I missed in my perusal of the standard.
I believe it is legal:
The preprocessor does its work in translation phase 4.Originally Posted by C99 Clause 6.4.1 Paragraph 2
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Hmmm ... that's interesting. I could have sworn I remember reading it was undefined behaviour.
I just looked up in the 1999 C standard (only one handy on my current machine) and the only reference I can find which is relevant is Section J.2, where it says that the behaviour is undefined if any standard header is #include'd while a macro is #define'd as a keyword.