[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#100103: marked as done (stdio.h is incomplete (strlen and others are missing))



Your message dated Fri, 8 Jun 2001 14:06:17 +0200
with message-id <20010608140617.B6961@herodot.math.ethz.ch>
and subject line Bug#100103: stdio.h is incomplete (strlen and others are missing)
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Darren Benham
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 8 Jun 2001 11:46:28 +0000
>From pfrauenf@math.ethz.ch Fri Jun 08 06:46:28 2001
Return-path: <pfrauenf@math.ethz.ch>
Received: from frege-d-math-north-g-west.math.ethz.ch (frege.math.ethz.ch) [::ffff:129.132.145.3] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 158Kii-0008F6-00; Fri, 08 Jun 2001 06:46:28 -0500
Received: (from daemon@localhost)
	by frege.math.ethz.ch (8.9.1/8.9.1) id NAA07277;
	Fri, 8 Jun 2001 13:46:19 +0200 (MET DST)
Received: from herodot(129.132.146.8), claiming to be "herodot.math.ethz.ch"
 via SMTP by frege, id smtpdAAAa001le; Fri Jun  8 13:46:13 2001
Received: from pfrauenf by herodot.math.ethz.ch with local (Exim 3.22 #1 (Debian))
	id 158KiN-0004UA-00; Fri, 08 Jun 2001 13:46:07 +0200
From: Philipp Frauenfelder <pfrauenf@math.ethz.ch>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: stdio.h is incomplete (strlen and others are missing)
X-Reportbug-Version: 1.15
X-Mailer: reportbug 1.15
Date: Fri, 08 Jun 2001 13:46:07 +0200
Message-Id: <[🔎] E158KiN-0004UA-00@herodot.math.ethz.ch>
Delivered-To: submit@bugs.debian.org

Package: gcc-3.0
Version: 1:3.0-0pre010526
Severity: normal

Hi

Compiling the following short program

#include <stdio.h>

int main (int argc, char** argv) {

  const char a[14] = "Hello World.\0";

  printf("length of a = %s is %i\n", a, strlen(a));

  return 0;
}

with gcc-3.0 yields a warning: "implicit declaration of function
`strlen'" although strlen is declared in stdio.h according to
the man page. The problem is, that gcc-3.0 does not read
/usr/include/stdio.h, where strlen is declared but reads
/usr/lib/gcc-lib/i386-linux/3.0/include/stdio.h instead. In this
file, strlen (and others, e.g. strncpy) are not declared.
/usr/lib/gcc-lib/i386-linux/3.0/include comes before
/usr/include in the include path of gcc-3.0:

gcc-3.0 -Wall -g -v    bug.c   -o bug
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0 20010526 (Debian prerelease)
 /usr/lib/gcc-lib/i386-linux/3.0/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1 -Wall -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ bug.c -quiet -dumpbase bug.c -g -Wall -version -o /tmp/ccdOKGjd.s
GNU CPP version 3.0 20010526 (Debian prerelease) (cpplib) (i386 Linux/ELF)
GNU C version 3.0 20010526 (Debian prerelease) (i386-linux)
        compiled by GNU C version 3.0 20010526 (Debian prerelease).
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/3.0/include
 /usr/include
End of search list.
bug.c: In function main':
bug.c:7: warning: implicit declaration of function strlen'
 as --traditional-format -V -Qy -o /tmp/cc0fFqGm.o /tmp/ccdOKGjd.s
GNU assembler version 2.11.90.0.7 (i386-linux) using BFD version 2.11.90.0.7
 /usr/lib/gcc-lib/i386-linux/3.0/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o bug /usr/lib/gcc-lib/i386-linux/3.0/../../../crt1.o /usr/lib/gcc-lib/i386-linux/3.0/../../../crti.o /usr/lib/gcc-lib/i386-linux/3.0/crtbegin.o -L/usr/lib/gcc-lib/i386-linux/3.0 -L/usr/lib/gcc-lib/i386-linux/3.0/../../.. /tmp/cc0fFqGm.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-linux/3.0/crtend.o /usr/lib/gcc-lib/i386-linux/3.0/../../../crtn.o

With gcc, this is not a problem: it just complains about strlen
not beeing defined, but with g++, this is a serious problem,
since it reports this as an error and stops compiling. (I am
using strlen in a C++ program.)

Regards,
Philipp

-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux herodot 2.4.3 #10 Die Apr 3 11:00:30 CEST 2001 i686

Versions of packages gcc-3.0 depends on:
ii  binutils                2.11.90.0.7-2    The GNU assembler, linker and bina
ii  cpp-3.0                 1:3.0-0pre010526 The GNU C preprocessor.           
ii  gcc-3.0-base            1:3.0-0pre010526 The GNU compiler collection (base 
ii  libc6                   2.2.3-1          GNU C Library: Shared libraries an
ii  libgcc0                 1:3.0-0pre010526 GCC support library.              


---------------------------------------
Received: (at 100103-done) by bugs.debian.org; 8 Jun 2001 12:06:53 +0000
>From pfrauenf@math.ethz.ch Fri Jun 08 07:06:53 2001
Return-path: <pfrauenf@math.ethz.ch>
Received: from frege-d-math-north-g-west.math.ethz.ch (frege.math.ethz.ch) [::ffff:129.132.145.3] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 158L2S-0000uC-00; Fri, 08 Jun 2001 07:06:53 -0500
Received: (from daemon@localhost)
	by frege.math.ethz.ch (8.9.1/8.9.1) id OAA09572;
	Fri, 8 Jun 2001 14:06:31 +0200 (MET DST)
Received: from herodot(129.132.146.8), claiming to be "herodot.math.ethz.ch"
 via SMTP by frege, id smtpdAAAa002LY; Fri Jun  8 14:06:24 2001
Received: from pfrauenf by herodot.math.ethz.ch with local (Exim 3.22 #1 (Debian))
	id 158L1t-0004mx-00; Fri, 08 Jun 2001 14:06:17 +0200
Date: Fri, 8 Jun 2001 14:06:17 +0200
To: Philip Blundell <pb@nexus.co.uk>, 100103-done@bugs.debian.org
Subject: Re: Bug#100103: stdio.h is incomplete (strlen and others are missing)
Message-ID: <20010608140617.B6961@herodot.math.ethz.ch>
References: <[🔎] E158KiN-0004UA-00@herodot.math.ethz.ch> <[🔎] E158Kqc-0006oP-00@mill.nexus.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
In-Reply-To: <[🔎] E158Kqc-0006oP-00@mill.nexus.co.uk>
User-Agent: Mutt/1.3.18i
X-face: &F3,Wvn26bINjDuT4fdLd_(SI!'modE=@md+cD6D!\d6c"~Acs7ab^>rv50@HLyJe;1A"~V bDC-G2|%OZTmpMh==l<iOPCO<E(k(]/;h2$>HlB^~&XA#FUv9OuG'ztN0ku]c~_jT|'L.a:^1m"T&~ q7
X-Operating-System: Debian GNU/Linux herodot 2.4.3
From: Philipp Frauenfelder <pfrauenf@math.ethz.ch>
Delivered-To: 100103-done@bugs.debian.org

Hi

On Fri, Jun 08, 2001 at 12:54:38PM +0100, Philip Blundell wrote:
> >with gcc-3.0 yields a warning: "implicit declaration of function
> >`strlen'" although strlen is declared in stdio.h according to
> >the man page.
> 
> This is incorrect: strlen is declared in <string.h>, not <stdio.h>.
> Refer to the glibc manual.

Ooops. You are right. How embarassing. Using
#include <cstring>
in C++ fixes my problem. Thanks.

Regards
-- 
Philipp      | work: pfrauenf@math.ethz.ch  +41 1 632 60 38
Frauenfelder | home: pfrauenf@debian.org    +41 1 862 73 14
[PGP]        | http://www.math.ethz.ch/~pfrauenf/
Proudly running Debian GNU/Linux. See http://www.debian.org/



Reply to: