www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/18/13:04:14

From: "Bart van den Burg" <bart AT bart99 DOT tmfweb DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: no return at all (was: `return' with no value, in function returning non-void)
Date: Thu, 18 Oct 2001 19:02:00 +0200
Organization: XO Communications B.V.
Lines: 60
Message-ID: <9qn1pj$gkm$1@cyan.nl.gxn.net>
References: <16a9b8d3 DOT 0110180325 DOT 4f2ff5e AT posting DOT google DOT com> <9qmfe4$iqt$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <9qmuod$fu2$1 AT cyan DOT nl DOT gxn DOT net> <Xns913E7D7DCC53AASINANUNUR AT 132 DOT 236 DOT 56 DOT 8>
NNTP-Posting-Host: asd-tel-ap02-d09-028.dial.freesurf.nl
X-Trace: cyan.nl.gxn.net 1003424371 17046 62.100.22.28 (18 Oct 2001 16:59:31 GMT)
X-Complaints-To: abuse AT freesurf DOT nl
NNTP-Posting-Date: 18 Oct 2001 16:59:31 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I did:

------------------ Console output: -------------------
C:\djgpp>copy con test.cpp
#include <iostream.h>

int someFunction() {
        cout << "hi";
}

void main() {
        someFunction();
}^Z
        1 file(s) copied.

C:\djgpp>gpp test.cpp -o test.exe

C:\djgpp>test
hi

C:\djgpp>ver

Microsoft Windows 2000 [Version 5.00.2195]
------------------------------------------------------

so you see:
no errors or warnings or whatsoever
Bart

"A. Sinan Unur" <asu1 AT cornell DOT edu> wrote in message
news:Xns913E7D7DCC53AASINANUNUR AT 132 DOT 236 DOT 56 DOT 8...
> "Bart van den Burg" <bart AT bart99 DOT tmfweb DOT nl> wrote in
> news:9qmuod$fu2$1 AT cyan DOT nl DOT gxn DOT net:
>
> > is it a DJGPP WIN2k bug that an int function doesn't have to return
> > anything?
>
> Change the subject line when you change the topic of a thread.
>
> Now, I am not sure what you mean. If you do the following:
>
> /* i.c */
> int blah(void)
> {
>   return;
> }
>
> C:\var>gcc -c i.c -Wall
> i.c: In function `blah':
> i.c:3: warning: `return' with no value, in function returning non-void
>
> do you not get a warning under W2K?
>
> Sinan.
> --
> --------------------------------
> A. Sinan Unur
> http://www.unur.com/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019