NO

Author Topic: ISO TR24731-1  (Read 4128 times)

czerny

  • Guest
ISO TR24731-1
« on: May 08, 2012, 01:08:49 PM »
If I try to compile this

Code: [Select]
#include <stdio.h>
#include <stdarg.h>

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

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

return 0;
}

I get the following error

Code: [Select]
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.

Code: [Select]
#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

  • Guest
Re: ISO TR24731-1
« Reply #1 on: May 08, 2012, 03:26:30 PM »
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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: ISO TR24731-1
« Reply #2 on: May 15, 2012, 04:29:03 PM »
It's a optional extension of C11 and __STDC_LIB_EXT1_ _ is still there (in my late draft of the C1X standard)...
/Pelle