X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Message-ID: <4F7C89D3.2070803@cs.utoronto.ca> Date: Wed, 04 Apr 2012 13:50:11 -0400 From: Ryan Johnson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: snprintf() with g++ -std=c++98: error: 'snprintf' was not declared in this scope References: <20120404133244 DOT GA2056 AT qp9482> <4F7C5470 DOT 3070805 AT cs DOT utoronto DOT ca> <20120404145445 DOT GA1548 AT qp9482> <20120404151837 DOT GA11484 AT calimero DOT vinschen DOT de> In-Reply-To: <20120404151837.GA11484@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 04/04/2012 11:18 AM, Corinna Vinschen wrote: > On Apr 4 16:54, Denis Excoffier wrote: >> On Wed, Apr 04, 2012 at 10:02:24AM -0400, Ryan Johnson wrote: >>>> On 04/04/2012 9:32 AM, Denis Excoffier wrote: >>>>> Hello, >>>>> >>>>> It could be that snprintf() is not properly declared in. >>>> According to [1], it's not officially part of c++98 (???). Try >>>> gnu++98 instead. As for why it's not in c++0x, there's a problem >>>> with the macros being defined [2] that AFAIK remains unresolved; >>>> again the workaround is gnu++0x. >>>> >>>> [1] http://cygwin.com/ml/cygwin/2010-01/msg00791.html >>>> [2] http://cygwin.com/ml/cygwin/2011-08/msg00311.html >>>> >> Oh, i should have found these, at least the first one... For c++0x, >> couldn't this be addressed now? As a start, i can (humbly) propose: >> >> --- stdio.h 2012-04-04 14:50:32.000000000 +0159 >> +++ stdio.h++ 2012-04-04 16:38:21.049273700 +0159 >> @@ -237,7 +237,7 @@ >> off_t _EXFUN(ftello, ( FILE *)); >> #endif >> #endif >> -#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__>= 199901L) >> +#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__>= 199901L) || (__cplusplus>= 201103L) > How is that supposed to work? > > $ gcc -xc++ -std=c++98 -dM -E -< /dev/null | grep cplus > #define __cplusplus 1 > > $ gcc -xc++ -std=c++0x -dM -E -< /dev/null | grep cplus > #define __cplusplus 1 > > Actually I'm wondering if that's not a bug in gcc: > > $ gcc -xc -std=c89 -dM -E -< /dev/null | grep STDC > #define __STDC_HOSTED__ 1 > #define __STDC__ 1 > > $ gcc -xc -std=c99 -dM -E -< /dev/null | grep STDC > #define __STDC_HOSTED__ 1 > #define __STDC_VERSION__ 199901L > #define __GNUC_STDC_INLINE__ 1 > #define __STDC__ 1 > > [~]$ gcc -xc++ -std=c++98 -dM -E -< /dev/null | grep STDC > #define __STDC_HOSTED__ 1 > #define __STDC__ 1 > [~]$ gcc -xc++ -std=c++0x -dM -E -< /dev/null | grep STDC > #define __STDC_HOSTED__ 1 > #define __STDC__ 1 > > Shouldn't -std=c++0x include the definitions for -std=c99, namely > > #define __STDC_VERSION__ 199901L > > ??? I figured it was a gcc bug from the start, but I don't know enough about the arcane art of juggling all possible combinations of __STDC__, __ANSI__, etc. and wouldn't know the first thing about a fix. I just live with -std=gnu++$WHATEVER for now. Ryan -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple