On Tue, 7 Jan 2014 12:17:03 +0500
Ivanko B <[email protected]> wrote:

>  in pascal you can't write functions with variable number of arguments
> AFAIK, "C uses "va_list" lfor that. And C uses the right-2-left stact
> order for procedures to handle "va_list" otherwise Pascal uses the
> left-2-right order making "va_list" handling problematic.Then
> "writeln" might be implemented as a consequence of single "write"-s
> for each argument

No no, freepascal and delphi CAN do that. They have "array of
consts" (or something like that) which you construct with [xx, yy, zz].
The net result is the same as C, and probably more clean.
The problem is that you pass printf() or format() a string and a
handful of arguments:

        printf("My name is %s and my age is %d", [myname, myage]);

and there is no check on arguments, and no check on correspondance
between arguments and positional specifiers "%blabla" in the string. In
the example above, the first %s asks for a string, and the second %d for
an integer. If you mistakely pass wrong arguments, or in wrong order
myname and myage, results can be catastrophic!

I tried to use the external function format() in linux libc from
pascal, and I didn't succeed. The problem was that, contrary to what
was stated in the manual, "open array of consts [...]" was not passed
to libc in a working way. I have no problems with delphi, instead; I
often use format() in windows, and every time I do I feel the
deprecating look of Martin behind my shoulders... :-)

Regards,
linuxfan



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to