Jump to content
  • Advertisement
Sign in to follow this  

Ellipsis function arguments in Delphi

This topic is 4769 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a symbol for doing something equivalent of ellipsis function arguments ("...") in Delphi? Google doesn't give me anything sensible, and neither does the Delphi7 manual:\ And could someone also please take the time to explain what it does? I don't find it easy to understand the Visual Studio manual on that part, to say it mildly.

Share this post

Link to post
Share on other sites
Well, the ellipsis in C is used to pass a variable amount of arguments at the end of the parameter list, but with no other information about them(type,number,etc...). For instance, it is used in printf:

printf("Print Numbers:%d %d %d",1,2,3)

as you see, you use the format string in the beginning to give additional information(you pass 3 arguments of type integer).

I haven't worked with Delphi since ver.5, but IIRC there wasn't an exact equivalent, but you could do pretty much the same using "array of const":

procedure SPrintF(formatstr:string;args:array of const);
//Do stuff here...

And you call the function like this: SPrintF('Number:%d %d %d',[1,2,3]);
It passes an array of type TVarRec, which is essentially variants.
The "Format" Delphi function does pretty much what SPrintF does, and uses "array of const".

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!