POV-Ray : Newsgroups : povray.general : Macro with variable number of parameters... : Re: Macro with variable number of parameters... Server Time
29 Jul 2024 18:23:01 EDT (-0400)
  Re: Macro with variable number of parameters...  
From: Nieminen Mika
Date: 9 Jul 1999 02:06:13
Message: <37859155@news.povray.org>
In povray.general Dick Balaska <dic### [at] buckosoftcom> wrote:
: The snprintf, vsnprintf, etc functions are years old and are there to help prevent
: the exploitable buffer overruns so common in bad code.  All good daemons should
: be using them.

  Perhaps they should, but they don't have to. snprintf is not part of the
ANSI C standard. If you use non-standard functions, you will be making
non-portable code.

pohjanrastas:~>cat test.c
#include <stdio.h>

int main(void)
{ char test[10];
  snprintf(test, 10, "%i", 2);
  printf("%s\n", test);
  return 0;
}
pohjanrastas:~>uname -a
SunOS pohjanrastas 5.5.1 Generic_103640-27 sun4m sparc SUNW,SPARCstation-4
pohjanrastas:~>gcc -Wall test.c 
test.c: In function `main':
test.c:5: warning: implicit declaration of function `snprintf'
/var/tmp/cc6HtB7O.o: In function `main':
/var/tmp/cc6HtB7O.o(.text+0x1c): undefined reference to `snprintf'
collect2: ld returned 1 exit status
pohjanrastas:~>

assari:~>uname -a
OSF1 assari V4.0 1091 alpha
assari:~>gcc -Wall test.c
test.c: In function `main':
test.c:5: warning: implicit declaration of function `snprintf'
/bin/ld:
Unresolved:
snprintf
collect2: ld returned 1 exit status
assari:~>


-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.