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 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> Content-Type: text/plain; charset=UTF-8 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 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 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