delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/18/05:37:42

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <464D68D5.1080306@sh.cvut.cz>
References: <464CBBD5 DOT 4040709 AT t-online DOT de> <464D68D5 DOT 1080306 AT sh DOT cvut DOT cz>
Date: Fri, 18 May 2007 11:36:51 +0200
To: cygwin AT cygwin DOT com
X-UMS: email
X-Mailer: TOI Kommunikationscenter V7-7-2
Subject: Re: _GLIBCXX_USE_C99 not working?
From: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
Message-ID: <1HoytI-1LDDbE0@fwd33.aul.t-online.de>
X-ID: r9XVU2ZJ8e-GRL8gWDObl1gJFwlRgPoqdskDQnrj4rzZz6W1vr9gEX AT t-dialin DOT net
X-TOI-MSGID: cfa2db3d-23e5-4f7e-9e96-e39408e2781b
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Václav Haisman wrote:
>> ...
>>    
> Look into the cstdlib header. You will find that llabs(long long) and
> abs(long long) are in the __gnu_cxx namespace there. It is because
long
> long is not C++ standard type.
>  

Yes - but abs() and llabs() is also included into std namespace a few
lines later.
The problem is that ::strtold() is also included, but does not exist in
Cygwin's stdlib.h:

cstdlib:
...
#include "stdlib.h"
...
#if _GLIBCXX_USE_C99

namespace __gnu_cxx
{
...
  inline long long
  llabs(long long __x) { return __x >= 0 ? __x : -__x; }
...
  using ::strtold;
}

namespace std
{
...
  using __gnu_cxx::llabs;
...
  using __gnu_cxx::strtold;
}
#endif



The llabs() in my testcase was only intended as a real-world (found
in ddrescue) usage example.

The problem occurs also if cstdlib is simply included, but not used:

#define _GLIBCXX_USE_C99 1
#include <cstdlib>

/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdlib:181:
 error: `::strtold' has not been declared
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdlib:200:
 error: `__gnu_cxx::strtold' has not been declared


This can be fixed by adding some dummy declaration of strtold:

#define _GLIBCXX_USE_C99 1
void strtold();
#include <cstdlib>


Christian




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019