| www.delorie.com/archives/browse.cgi | search |
| Newsgroups: | comp.os.msdos.djgpp |
| From: | "Mike Ruskai" <thanny AT spambegone DOT home DOT com> |
| Message-ID: | <gunaalubzrpbz.f1eman4.pminews@news.avnl1.nj.home.com> |
| References: | <5zeY1.843$SI2 DOT 270 AT news DOT cwix DOT com> <gunaalubzrpbz DOT f1bmi21 DOT pminews AT news DOT avnl1 DOT nj DOT home DOT com> <3631E505 DOT 4773CBD3 AT montana DOT com> <gunaalubzrpbz DOT f1cmla2 DOT pminews AT news DOT avnl1 DOT nj DOT home DOT com> <36329321 DOT 21F4ACAD AT montana DOT com> |
| X-Newsreader: | PMINews 2.00.1201 For OS/2 |
| Organization: | TLF |
| MIME-Version: | 1.0 |
| Subject: | Re: construction has been delayed due to somebody's stupidity (most likely my own) |
| Lines: | 36 |
| Date: | Sun, 25 Oct 1998 22:25:36 GMT |
| NNTP-Posting-Host: | 24.3.130.120 |
| NNTP-Posting-Date: | Sun, 25 Oct 1998 14:25:36 PDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
On Sat, 24 Oct 1998 20:55:29 -0600, bowman wrote:
>
>
>Mike Ruskai wrote:
>>
>> >int main(void)
>> >{
>> > MyClass instance(); // point of interest
>> > instance.say_hi();
>> >}
>> This is bad because you're declaring a function instead of defining a
>> variable.
>
>sigh. yes, one too many cut and pastes. Make that three ways not to do
>it.
>It is interesting that one can declare a function returning MyClass,
>never define or
>use it, and the compiler never says a word, while it will emit warnings
>for used
>variables.
That would be annoying in the extreme. Do you really want to see a warning
for every header file that declares but not defines functions (e.g. the
entire C library)? Compilers can remove unreferenced functions, and if you
do refer to it, the linker will complain about an unresolved external.
I never enable warnings about unused variables, personally.
--
- Mike
Remove 'spambegone' to send e-mail.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |