D - what about vaarg and default parameters?
- bobef (3/3) Apr 24 2004 i couldn't find anything about variable arguments ( int f(int x,...) )
- J Anderson (5/9) Apr 24 2004 Not supported (I wish it was).
- renZYX hotmail.com (6/17) Apr 24 2004 Does this means that D is also vulnerable to the 'format string exploit'...
- Ilya Minkov (4/8) Apr 24 2004 Exactly what you expect in C. That's one of the many reasons why you
- Unknown W. Brackets (31/36) Apr 24 2004 In my very humble opinion, *one* of these solutions should be available....
i couldn't find anything about variable arguments ( int f(int x,...) ) and default parameters ( int func(int x=0) ) in the documentation... anyone knows about this?
Apr 24 2004
bobef wrote:i couldn't find anything about variable arguments ( int f(int x,...) )Same as C.and default parameters ( int func(int x=0) ) in the documentation... anyone knows about this?Not supported (I wish it was). -- -Anderson: http://badmama.com.au/~anderson/
Apr 24 2004
In article <c6d6n9$1n5v$1 digitaldaemon.com>, J Anderson says...bobef wrote:Does this means that D is also vulnerable to the 'format string exploit'? Or is-it catched by the array bound checking? What happens if someone do: printf("%s"); ? Best regards.i couldn't find anything about variable arguments ( int f(int x,...) )Same as C.RenoXand default parameters ( int func(int x=0) ) in the documentation... anyone knows about this?Not supported (I wish it was). -- -Anderson: http://badmama.com.au/~anderson/
Apr 24 2004
renZYX hotmail.com schrieb:Does this means that D is also vulnerable to the 'format string exploit'? Or is-it catched by the array bound checking? What happens if someone do: printf("%s"); ?Exactly what you expect in C. That's one of the many reasons why you better not use varargs until we have better ones. -eye
Apr 24 2004
J Anderson wrote:bobef wrote:In my very humble opinion, *one* of these solutions should be available. Whether they are going to be inlined or not, having to make a dozen function definitions to "redirect" to other functions is a pain, and the way I program I use defaulting whenever possible. As an example, PHP is rather good support for this - and many of the built in functions for it, as well as custom ones, have benefitted greatly. Perhaps the biggest advantage is: Old function: void doSomethingWith(int i); New function: void doSomethingWith(int i, bool specialCoolNewFlag = false); In other words, it allows extension of pre-existing functions without losing the functionality. PHP has done this with functions such as print_r. (print readable, meaning format any variable in a very readable format, extremely useful for debugging.) In PHP 4.3.0, they added a flag "return" to it so you could chose to have the output RETURNED instead of outputted by the previously void function. Right now you'd have to overload it with a quick function that just calls the non-overloaded version. And ugly way to get around the issue... Defaulting is also useful when you have a parameter that is an array, and could be "none". It is logical to simply omit this parameter, instead of providing an empty array... The entire Zend (PHP) API uses, basically, variable functions - meaning every PHP function that is written in C uses an array to store it's passed parameter list. But, it's an array of zval objects, which are basically variants - not really a built in thing. This is why I think support for defaulted parameters would be terribly useful, and make variable argument lists (which are difficult to well implement..) unneccessary in most cases. -[Unknown]and default parameters ( int func(int x=0) ) in the documentation... anyone knows about this?Not supported (I wish it was).
Apr 24 2004