🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Jason Merrill Fri, 04 Sep 1992 20:44
built-in strlen returns long unsigned int?
#1065
Author: Jason Merrill
Date: Fri, 04 Sep 1992 20:44
52 lines
1835 bytes
Compiling libg++ 2.2 with gcc 2.2.2, I get the following result:

-----
gcc -g  -I.. -I../../../libg++/src -I../../../libg++/src/../iostream
-I../../../libg++/src/../g++-include  -c ../../../libg++/src/AllocRing.cc 

In file included from ../../../libg++/src/std.h:26, from
../../../libg++/src/AllocRing.cc:22:

../../../libg++/src/../g++-include/string.h:28: declaration of `int  strlen
(const char *)'

<built-in>:0: conflicts with built-in declaration `long unsigned int
strlen (const char *)'
-----

Why does gcc think that strlen should return long unsigned int, rather than
int?  How does it go about deciding the return type for these built-in
functions?  I haven't been able to find the place in the make process where
this happens.

I am working on a Sequent Symmetry running Dynix.  The string.h we are
using comes, I believe, from the AT&T C++ translator v1.2, and looks like
this:


/*	@(#)string.h	1.2	*/
extern char
	*strcpy(),
	*strncpy(),
	*strcat(),
	*strncat(),
	*strchr(),
	*strrchr(),
	*strpbrk(),
	*strtok();
extern int
	strcmp(),
	strncmp(),
	strlen(),
	strspn(),
	strcspn();

Would the absence of "int" in front of "strlen()" be confusing the make
process?  The strings.h on the machine is the Sequent version, and has the
ususal-style declaration.

--
Jason Merrill
jason@jarthur.claremont.edu
-- 
Fool on a Pedestal
Re: built-in strlen returns long unsigned int?
#1091
Author: John Clark
Date: Tue, 08 Sep 1992 19:52
39 lines
1650 bytes
In article <1992Sep4.204457.25043@muddcs.claremont.edu> jason@jarthur.claremont.edu (Jason Merrill) writes:
+../../../libg++/src/../g++-include/string.h:28: declaration of `int  strlen
+(const char *)'
+
+<built-in>:0: conflicts with built-in declaration `long unsigned int
+strlen (const char *)'
+-----
+
+Why does gcc think that strlen should return long unsigned int, rather than
+int?  How does it go about deciding the return type for these built-in

Because ANSI C library definitions have:

size_t strlen( const char *);


+functions?  I haven't been able to find the place in the make process where
+this happens.

Look at the file 'sys-protos.h' in the gcc-2.2.2 directory.

+I am working on a Sequent Symmetry running Dynix.  The string.h we are
+using comes, I believe, from the AT&T C++ translator v1.2, and looks like
+this:
+
+
+/*	@(#)string.h	1.2	*/
+extern char
+	*strcpy(),
+	*strncpy(),


Appears to be non-ANSI standard string declarations. Get the book,
'The Standard C Library' by P.J. Plauger which describes the various
declarations for the ANSI library functions.
-- 

John Clark
jclark@ucsd.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads