www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/20/01:30:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.0 c=1 a=eTbUwMriiJkA:10 a=kCKDY91tEBMc+hi4YtGk8Q==:17 a=0ZjzN1xEamSbqzhq0kAA:9 a=ovSZov12ZdaRSRzOkZwA:7 a=G3LyI2AspRpE5cFwl0wWU5GcdHYA:4
Message-ID: <4B56A2E9.4060008@monai.ca>
Date: Tue, 19 Jan 2010 22:30:01 -0800
From: Steven Monai <steve+cygwin AT monai DOT ca>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: g++: -ansi flag makes snprintf() unavailable?
References: <4B56745F DOT 9070903 AT monai DOT ca> <4B568160 DOT 3070300 AT byu DOT net>
In-Reply-To: <4B568160.3070300@byu.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

On 2010/01/19 8:06 PM, Eric Blake wrote:
> Using -ansi generally says that you want the headers to expose ONLY the
> interfaces mentioned in the C89 standard.  But C89 did not describe
> snprintf, hence your compilation failure.

Actually, it looks like -ansi means something slightly different when
used in C++ mode. According to the gcc manual, -ansi in C++ mode is
equivalent to -std=c++98 , which in English means "use the 1998 ISO C++
standard plus amendments".

Googling "1998 ISO C++ standard", I was able to find something that
looks like an official ISO document which covers this standard, and its
<cstdio> library does _not_ mention snprintf(), just as you stated.

Thus, it appears that in this case the Cygwin compiler's behaviour is
correct (i.e. to treat snprintf as undefined under -ansi), while the
Debian compiler has it wrong. Interesting!

> In the meantime, either don't use snprintf without declaring it by hand,
> or else don't use -ansi, since they are obviously not compatible in the
> current state of the headers.

Will do. Thanks for your time.

-SM
--

--
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

- Raw text -


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