JohnOne Posted September 1, 2012 Posted September 1, 2012 I'm not really after discussing these for use, nor would I be so bold as to make what I want to hearabout, a feature request.Rather an idea as to how difficult a task it would be to implement such functionality intoAutoIt, but not without first conceding that I have only just got to reading about ...va_listva_startva_endI do though of course think that such functionality would be a great feature in the language, whileI also realize the accepted workaround is to pass an array as an arg to an function.Would this sort of thing require a whole new Func type Keyword? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Valik Posted September 1, 2012 Posted September 1, 2012 (edited) I do though of course think that such functionality would be a great feature in the language,Variable argument lists are very rarely used in user code. They are useful in specific cases in libraries and by far the most common use I have for them is in a wrapper or hook function. The intermediary function accepts some of the arguments and a variable argument list. It does it's thing on the arguments it cares about and then forwards everything to the original function. In C++ the only time I've ever used it is centered around using some of the C string formatting functions.The point is, while it can be a useful feature, it's not a game changer or anything. Most people do not need it.Would this sort of thing require a whole new Func type Keyword?No. Edited September 1, 2012 by Valik
JohnOne Posted September 1, 2012 Author Posted September 1, 2012 In the tutorial I was reading it did mention that printf "can accept a variable list of arguments" So I guess that could be the "C string formatting functions" you spoke of.I've probably only once found myself looking for such a feature in AutoIt once, but quickly justused an array.I never knew such a thing existed in C++, It's a pretty great feature I think even if the sameeffect can be achieved in other ways. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Valik Posted September 2, 2012 Posted September 2, 2012 It's not great feature in a heavily typed language. It's not type safe. That's why printf() and similar are so dangerous and crash prone.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now