![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sun, 04 Jul 1999 16:09:31 -0700, "Jon A. Cruz"
<jon### [at] geocities com> wrote:
>Ron Parker wrote:
>
>> On Sun, 04 Jul 1999 17:17:33 -0400, Matt Giwer
>> <mgi### [at] giwersworld org> wrote:
>>
>> > It is also a dangerous language that would permit what you want.
>> >FORTH comes to mind.
>>
>> C and C++ come to mind too. I couldn't live without varargs.
>So, does your code have lots of GOTO's also? Functions named things like
>"function1()" and "func2()"? Void pointers cast all over the place? ;-)
Nah. But varargs is a thing that can't be done any other way. I have
this function called ODS that takes printf-style arguments, sprintf's
into a buffer, and calls OutputDebugString. I don't know of any other
sane way to do that. Streams are not considered sane, BTW.
Well... actually... now you mention it, I do have lots of void
pointers too. Object-oriented programming has a purpose, but when it
gets in the way, I find a different tool.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ron Parker wrote:
> On Sun, 04 Jul 1999 16:09:31 -0700, "Jon A. Cruz"
> <jon### [at] geocities com> wrote:
>
> >Ron Parker wrote:
> >
> >> On Sun, 04 Jul 1999 17:17:33 -0400, Matt Giwer
> >> <mgi### [at] giwersworld org> wrote:
> >>
> >> > It is also a dangerous language that would permit what you want.
> >> >FORTH comes to mind.
> >>
> >> C and C++ come to mind too. I couldn't live without varargs.
>
> >So, does your code have lots of GOTO's also? Functions named things like
> >"function1()" and "func2()"? Void pointers cast all over the place? ;-)
>
> Nah. But varargs is a thing that can't be done any other way. I have
> this function called ODS that takes printf-style arguments, sprintf's
> into a buffer, and calls OutputDebugString. I don't know of any other
> sane way to do that. Streams are not considered sane, BTW.
>
> Well... actually... now you mention it, I do have lots of void
> pointers too. Object-oriented programming has a purpose, but when it
> gets in the way, I find a different tool.
Ewwww! void pointers are Evil.
Of course, when programming for Windows, I am often forced to use them. :-(
Let's try not to corrupt those poor, impressionable programmers out there.
Oh. That brings things back on topic. :-) It could be used for things, but
then again there is great danger, so it's probably best to keep it out.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Macro with variable number of parameters...
Date: 5 Jul 1999 02:16:17
Message: <37804db1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In povray.general Ron Parker <par### [at] fwi com> wrote:
: Nah. But varargs is a thing that can't be done any other way. I have
: this function called ODS that takes printf-style arguments, sprintf's
: into a buffer, and calls OutputDebugString. I don't know of any other
: sane way to do that. Streams are not considered sane, BTW.
sprintf is evil (unless you know exactly the size of the output).
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> sprintf is evil (unless you know exactly the size of the output).
but snprintf is not.
dik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Macro with variable number of parameters...
Date: 6 Jul 1999 09:37:24
Message: <37820694@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In povray.general Dick Balaska <dic### [at] buckosoft com> wrote:
: but snprintf is not.
snprintf is not a standard function.
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> In povray.general Dick Balaska <dic### [at] buckosoft com> wrote:
> : but snprintf is not.
>
> snprintf is not a standard function.
I use it on all the time on code that compiles with VC++, gcc, and c89.
That's standard enough for me.
dik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Macro with variable number of parameters...
Date: 8 Jul 1999 01:27:29
Message: <378436c1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In povray.general Dick Balaska <dic### [at] buckosoft com> wrote:
: I use it on all the time on code that compiles with VC++, gcc, and c89.
: That's standard enough for me.
Well, as long as you don't compile it in a SunOS or Digital Unix or other
OS's...
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> In povray.general Dick Balaska <dic### [at] buckosoft com> wrote:
> : I use it on all the time on code that compiles with VC++, gcc, and c89.
> : That's standard enough for me.
>
> Well, as long as you don't compile it in a SunOS or Digital Unix or other
> OS's...
...with a compiler that is more than 3 years old.
Linux, *BSD, Solaris, SunOS 4.1.[34] = gcc
Dec Unix (Alpha), HP-UX 9-10, SCO = c89
Win9[58], NT4 = VC++
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.
c89 comes from the loins of Digital Unix.
Sun has been trying to kill SunOS for almost 10 years, so i don't expect
it's native compiler to be very up to date. I switched to gcc on SunOS 7 or 8 years
ago because its compiler (cc?) was very buggy and unsupported.
dik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Macro with variable number of parameters...
Date: 9 Jul 1999 02:06:13
Message: <37859155@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In povray.general Dick Balaska <dic### [at] buckosoft com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |