Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: "Martin Sinot" <martin@spase.nl>
Subject: Re: Cxx Compile error
Date: 2000/04/27	[thread overview]
Message-ID: <k0YN4.15399$w07.200089@nlnews00.chello.com> (raw)
In-Reply-To: 3908283E.B2CB22A4@hccnet.nl


bubble <j.j.b.weinberg@hccnet.nl> wrote in message
news:3908283E.B2CB22A4@hccnet.nl...
> Hi there,
>
> I was trying to compile blackbox using cxx from compaq.
> All was going well until the compiler hit Icon.cc where it gave the
> following error:
>
> cxx: Error: Icon.cc, line 137: identifier "strcmp" is undefined
> if (strcmp(name, "Unnamed")) {
> ____________^
>
> could comeone xplain why the identifier is undefined,
> and strcmp is a function or am I really mistaken.
> Keep in mind I am a novice at C.
>
> Thanks for your trouble
>
> Jigal

#include <string.h>

In C, it is allowed to use a function without declaring it before.
The compiler will issue a warning and treat it as a function with
unknown parameters and returning int. Very dangerous on Alphas,
if the function happens to return a pointer.
In C++ this is forbidden. Functions must always be declared before
use. g++ allows the use of undefined functions on the same basis
as C, but this is not correct (g++ allows too much). Most other
C++ compilers correctly reject undeclared functions.
Unfortunately, some programmers are sloppy, use undeclared functions
and turn off compiler warnings rather than fixing them. Reason why
a program can be accepted by g++ and not by another compiler (like
Compaq cxx).


--
Martin Sinot
Nijmegen, Netherlands
martin@spase.nl





  parent reply	other threads:[~2000-04-27  4:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-27  4:00 Cxx Compile error bubble
2000-04-27  4:00 ` bubble
2000-04-27  4:00   ` Alex Rhomberg
2000-04-27  4:00   ` Aaron Sawyer
2000-04-27  4:00     ` bubble
2000-04-27  4:00       ` Tony Hammitt
2000-04-27  4:00 ` Martin Sinot [this message]
2000-04-27  4:00   ` bubble
2000-04-27  4:00 ` bubble
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox