public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <orr9xelie0.fsf@tiete.dcc.unicamp.br>]
* egcs 1.1a on DEC alpha OSF/3.2, problem with include files
@ 1998-09-09  4:04 kuball
  1998-09-09 23:49 ` Alexandre Oliva
  0 siblings, 1 reply; 12+ messages in thread
From: kuball @ 1998-09-09  4:04 UTC (permalink / raw)
  To: egcs-bugs

I'm having a problem with the prototypes of the functions strncmp and
bcopy. The c++ compiler does not see them, the c compiler does.
Consider the following code:

#include <string.h>
#include <fstream.h>

//extern "C" int strncmp( const char*, const char*, int );
//extern "C" void bcopy( const char*, char*, int );

int
main( int, char** )
{
  char buf[40];
  bcopy( "This is a small test", buf, 21 );
  cout << buf << endl;

  cout << "test ncmp: " << strncmp( "this", "that", 2 ) << endl;
  cout << "test cmp: " << strcmp( "this", "that" ) << endl;

  return( 0 );  
}

compiling the above program gives the following warnings:

>gcc test.cpp -lstdc++
test.cpp: In function `int main(int, char **)':
test.cpp:12: warning: implicit declaration of function `int bcopy(...)'
test.cpp:15: warning: implicit declaration of function `int strncmp(...)'
>

though the resulting program works. Uncomenting the prototypes solves
the problem. Well, I looked into the string.h include file from

 /usr/local/lib/gcc-lib/alpha-dec-osf3.2/egcs-2.91.57/include

but found no notable difference between the prototype for strcmp and
strncmp. So, why does it not work?


Martin Kuball





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1998-09-16  5:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199809110842.KAA09831@zedo.fuedo.de>
1998-09-11 22:38 ` egcs 1.1a on DEC alpha OSF/3.2, problem with include files Alexandre Oliva
1998-09-14  4:35   ` kuball
     [not found] <orr9xelie0.fsf@tiete.dcc.unicamp.br>
1998-09-14 13:55 ` Jeffrey A Law
1998-09-15 15:30   ` Alexandre Oliva
1998-09-15 15:39     ` Jeffrey A Law
1998-09-15 19:06       ` Alexandre Oliva
1998-09-16  1:43         ` Jeffrey A Law
1998-09-16  5:01       ` kuball
1998-09-09  4:04 kuball
1998-09-09 23:49 ` Alexandre Oliva
1998-09-10  4:04   ` kuball
1998-09-10  7:15     ` Alexandre Oliva

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).