help-gplusplus
[Top][All Lists]
Advanced

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

Re: errno bug?


From: Maurizio Loreti
Subject: Re: errno bug?
Date: 06 Oct 2004 10:59:32 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"E. Robert Tisdale" <E.Robert.Tisdale@jpl.nasa.gov> writes:

>          > cat main.cc
>          #include <stdio.h>
>          #include <errno.h>
> 
>          extern int errno;
> 
>          int main(int argc, char* argv[]) {
>            return 0;
>            }
> 
>          > g++ -Wall -ansi -pedantic -o main main.cc
>          main.cc:4: error: declaration of `int* __errno_location()' \
>          throws different exceptions
>          /usr/include/bits/errno.h:38: error: \
>          than previous declaration `int* __errno_location() throw ()'
>          > g++ --version
>          g++ (GCC) 3.4.1
>          > cat /etc/fedora-release
>          Fedora Core release 2 (Tettnang)

No -- *your* bug.  "errno" is declared in "errno.h"; you cannot
declare it (in a different way).

MLO@mlinux 15 $ cat foo.cc
#include <iostream>

extern "C" {
  #include <errno.h>
}

int main() {
  std::cout << "errno = " << errno << std::endl;
}
MLO@mlinux 16 $ g++ -std=c++98 -pedantic -W -Wall -o foo foo.cc && ./foo
errno = 0
MLO@mlinux 17 $ g++ --version
g++ (GCC) 3.4.2
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MLO@mlinux 18 $

-- 
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy              ROT13: ybergv@cq.vasa.vg


reply via email to

[Prev in Thread] Current Thread [Next in Thread]