Click here to Skip to main content
15,887,027 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
jschell21-Dec-23 4:11
jschell21-Dec-23 4:11 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
PIEBALDconsult21-Dec-23 5:29
mvePIEBALDconsult21-Dec-23 5:29 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Gary Wheeler21-Dec-23 6:46
Gary Wheeler21-Dec-23 6:46 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
hpcoder217-Jan-24 16:12
hpcoder217-Jan-24 16:12 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
PIEBALDconsult21-Dec-23 4:18
mvePIEBALDconsult21-Dec-23 4:18 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
0x01AA21-Dec-23 5:02
mve0x01AA21-Dec-23 5:02 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
honey the codewitch21-Dec-23 4:25
mvahoney the codewitch21-Dec-23 4:25 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Gary Wheeler21-Dec-23 7:06
Gary Wheeler21-Dec-23 7:06 
honey the codewitch wrote:
Interestingly you can call main() from inside your C app, but not in C++.
Really? I didn't know that.

I'll admit it's probably not a good idea, and there are easy ways around the prohibition, ... Hmm. I think I've figured some of it out.
  • There are multiple valid forms of main(...), and implementation-defined arguments are allowed. Allowing calls to it might require too much special case handling between the compiler and linker to ensure a match between the call and the actual implementation.
  • Another factor might be runtime initialization that takes place in main()'s prolog.
  • Objects declared static could potentially call main() before it had been called for the actual application startup. Dead | X|
Sounds like the prohibition is a good way to make the compiler, linker, and runtime initialization job easier.
Software Zen: delete this;

GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
honey the codewitch21-Dec-23 7:08
mvahoney the codewitch21-Dec-23 7:08 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
CPallini21-Dec-23 7:41
mveCPallini21-Dec-23 7:41 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
honey the codewitch21-Dec-23 7:42
mvahoney the codewitch21-Dec-23 7:42 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
CPallini21-Dec-23 10:25
mveCPallini21-Dec-23 10:25 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
honey the codewitch21-Dec-23 10:26
mvahoney the codewitch21-Dec-23 10:26 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
megaadam21-Dec-23 11:55
professionalmegaadam21-Dec-23 11:55 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
jschell22-Dec-23 6:44
jschell22-Dec-23 6:44 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
honey the codewitch22-Dec-23 6:48
mvahoney the codewitch22-Dec-23 6:48 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
jschell22-Dec-23 6:51
jschell22-Dec-23 6:51 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
englebart21-Dec-23 5:28
professionalenglebart21-Dec-23 5:28 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Gerry Schmitz21-Dec-23 8:02
mveGerry Schmitz21-Dec-23 8:02 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
glennPattonWork322-Dec-23 1:16
professionalglennPattonWork322-Dec-23 1:16 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
mdblack9822-Dec-23 2:10
mdblack9822-Dec-23 2:10 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Owen Lawrence22-Dec-23 5:19
Owen Lawrence22-Dec-23 5:19 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Juan Pablo Reyes Altamirano22-Dec-23 5:49
Juan Pablo Reyes Altamirano22-Dec-23 5:49 
GeneralRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
jschell22-Dec-23 7:09
jschell22-Dec-23 7:09 
AnswerRe: ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ? Pin
Ralf Quint22-Dec-23 7:27
Ralf Quint22-Dec-23 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.