public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <jbuck@synopsys.com>
To: g++@cygnus.com, egcs@cygnus.com
Subject: implicit declaration in C++ considered harmful
Date: Wed, 08 Apr 1998 02:13:00 -0000	[thread overview]
Message-ID: <199804080026.RAA28665@atrus.synopsys.com> (raw)

I'd like to nuke the implicit declaration of functions in C++.  This
thoroughly broken feature cannot be turned off.

Yes, you get a warning, and you can make warnings errors, but the problem
is that if a user forgets to declare a function, or mistypes it, cascades
of dozens of errors can result, because g++ declares it as int foo(...),
then objects to all class objects passed to this function, then objects
to use of the result in a context where ints aren't allowed, etc.
Or else the file compiles normally, and errors aren't noticed until link
time.

Now, in the early days of C++ when we were all basically C programmers,
this hangover from K&R C may have been desirable.  But the time is overdue
to kill this sucker; these days, chances are good that most functions
I write are going to get a class object passed to them, so the default
declaration just can't be right.

First, it should be an error, not a warning.  Second, the compiler should
insert an error node, not a function returning integer, so that we don't
get a cascade of errors.

Is there anyone who really wants the existing behavior?

Joe


             reply	other threads:[~1998-04-08  2:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-08  2:13 Joe Buck [this message]
1998-04-08  7:35 ` Gabriel Dos Reis
1998-04-08 21:20 Kaz Kylheku
1998-04-08 17:25 ` Joe Buck
1998-04-09 18:29 ` Martin von Loewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199804080026.RAA28665@atrus.synopsys.com \
    --to=jbuck@synopsys.com \
    --cc=egcs@cygnus.com \
    --cc=g++@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).