delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-3.0 required=5.0 tests=BAYES_00,J_CHICKENPOX_83,RCVD_IN_DNSWL_LOW |
X-Spam-Check-By: | sourceware.org |
Date: | Mon, 20 Apr 2009 00:00:35 +0300 (EEST) |
From: | Markus Rinne <markus DOT rinne AT tut DOT fi> |
To: | cygwin AT cygwin DOT com |
Subject: | 1.7: snprintf() with gcc -std=c99: warning about implicit declaration |
Message-ID: | <alpine.LNX.2.00.0904192315360.3751@fenrir.sidaroth.foo> |
User-Agent: | Alpine 2.00 (LNX 1167 2008-08-23) |
MIME-Version: | 1.0 |
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 |
---1463811583-1435378703-1240174842=:3751 Content-Type: TEXT/PLAIN; format=flowed; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT Hello, compiling C programs which use snprintf function with gcc option -std=c99 gives a warning about implicit declaration of snprintf. Should snprintf be declared by including stdio.h when using C99 standard? For example, with the following program in snprintf.c: #include <stdio.h> int main(void) { char buf[10]; snprintf(buf, 10, "%i", 0); return 0; } Compiling with gcc-3 and gcc-4 gives these warnings: $ gcc-3 -std=c99 snprintf.c snprintf.c: In function `main': snprintf.c:6: warning: implicit declaration of function `snprintf' $ gcc-4 -std=c99 snprintf.c snprintf.c: In function ¡main¢: snprintf.c:6: warning: implicit declaration of function ¡snprintf¢ snprintf.c:6: warning: incompatible implicit declaration of built-in function ¡snprintf¢ Here are package versions checked with cygcheck -c: cygwin: 1.7.0-46 gcc-core: 3.4.4-999 gcc4-core: 4.3.2-2 It seems gcc defines __STRICT_ANSI__ when passed the -std=c99 option and the declaration of snprintf is enclosed in #ifndef __STRICT_ANSI__ in stdio.h. Markus Rinne ---1463811583-1435378703-1240174842=:3751 Content-Type: TEXT/PLAIN; charset=UTF-8; name=cygcheck.out Content-Transfer-Encoding: BASE64 Content-ID: <alpine DOT LNX DOT 2 DOT 00 DOT 0904200000350 DOT 3751 AT fenrir DOT sidaroth DOT foo> Content-Description: Content-Disposition: attachment; filename=cygcheck.out DQ0KQ3lnd2luIENvbmZpZ3VyYXRpb24gRGlhZ25vc3RpY3MNDQpDdXJyZW50 IFN5c3RlbSBUaW1lOiBTdW4gQXByIDE5IDIxOjI0OjU4IDIwMDkNDQoNDQpX aW5kb3dzIFhQIFByb2Zlc3Npb25hbCBWZXIgNS4xIEJ1aWxkIDI2MDAgU2Vy dmljZSBQYWNrIDMNDQoNDQpQYXRoOglDOlxjeWd3aW4tMS43XHVzclxsb2Nh bFxiaW4NDQoJQzpcY3lnd2luLTEuN1xiaW4NDQoJQzpcY3lnd2luLTEuN1xi aW4NDQoJQzpcY3lnd2luLTEuN1x1c3JcWDExUjZcYmluDQ0KCUM6XFdJTkRP V1Ncc3lzdGVtMzINDQoJQzpcV0lORE9XUw0NCglDOlxXSU5ET1dTXFN5c3Rl bTMyXFdiZW0NDQoJQzpcUHJvZ3JhbSBGaWxlc1xUaGlua1BhZFxZaHRleXNh cHVvaGplbG1hdA0NCglDOlxQcm9ncmFtIEZpbGVzXENvbW1vbiBGaWxlc1xM ZW5vdm8NDQoJQzpcUHl0aG9uMjVcDQ0KCUM6XFdJTkRPV1Ncc3lzdGVtMzJc V2luZG93c1Bvd2VyU2hlbGxcdjEuMA0NCglDOlxQcm9ncmFtIEZpbGVzXExl bm92b1xDbGllbnQgU2VjdXJpdHkgU29sdXRpb24NDQoJQzpcUHJvZ3JhbSBG aWxlc1xJbnRlbFxXaU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yL2JpbiAgIHN5c3RlbSAgYmlubW9kZQ0NCkM6XGN5Z3dpbi0x LjdcbGliICAvdXNyL2xpYiAgIHN5c3RlbSAgYmlubW9kZQ0NCi4gICAgICAg ICAgICAgICAgICAvY3lnZHJpdmUgIHVzZXIgICAgYmlubW9kZSxjeWdkcml2 ZQ0NCg0NCkZvdW5kOiBDOlxjeWd3aW4tMS43XGJpblxhd2suZXhlDQ0KRm91 bmQ6IEM6XGN5Z3dpbi0xLjdcYmluXGF3ay5leGUNDQogLT4gQzpcY3lnd2lu LTEuN1xiaW5cZ2F3ay5leGUNDQpGb3VuZDogQzpcY3lnd2luLTEuN1xiaW5c YmFzaC5leGUNDQpGb3VuZDogQzpcY3lnd2luLTEuN1xiaW5cYmFzaC5leGUN DQpGb3VuZDogQzpcY3lnd2luLTEuN1xiaW5cY2F0LmV4ZQ0NCkZvdW5kOiBD OlxjeWd3aW4tMS43XGJpblxjYXQuZXhlDQ0KRm91bmQ6IEM6XGN5Z3dpbi0x LjdcYmluXGNwLmV4ZQ0NCkZvdW5kOiBDOlxjeWd3aW4tMS43XGJpblxjcC5l eGUNDQpGb3VuZDogQzpcY3lnd2luLTEuN1xiaW5cY3BwLmV4ZQ0NCkZvdW5k OiBDOlxjeWd3aW4tMS43XGJpblxjcHAuZXhlDQ0KIC0+IEM6XGN5Z3dpbi0x LjdcZXRjXGFsdGVybmF0aXZlc1xjcHANDQogLT4gQzpcY3lnd2luLTEuN1xi aW5cY3BwLTMuZXhlDQ0K ---1463811583-1435378703-1240174842=:3751 Content-Type: text/plain; charset=us-ascii -- 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/ ---1463811583-1435378703-1240174842=:3751--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |