News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

ISO TR24731-1

Started by czerny, May 08, 2012, 01:08:49 PM

Previous topic - Next topic

czerny

If I try to compile this


#include <stdio.h>
#include <stdarg.h>

int main(void)
{
char s[20];

vsprintf_s(s,20,"","");

return 0;
}


I get the following error


tst6\main.c(9): warning #2018: Undeclared function 'vsprintf_s'; assuming 'extern' returning 'int'.


I always remember, that I have to #define something to allow this function. But always I search half a hour or even longer the help file until I finally find the right hint.


#define __STDC_WANT_LIB_EXT1__ 1


Today I have noticed that vsprintf_s is marked with [TR24731-1] in its help head. So hopefully I get it quicker next time.

But I too read that this is a C11 function now.

Shouldn't it be available now without any defines if C11 is enabled?

czerny

iZzz32

Quote from: ISO/IEC 9899:2011, K.3.1.1 (3)It is implementation-defined whether the functions, macros, and types declared or defined in K.3 and its subclauses are declared or defined by their respective headers if __STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file where the appropriate header is first included.

Pelle

It's a optional extension of C11 and __STDC_LIB_EXT1_ _ is still there (in my late draft of the C1X standard)...
/Pelle