April 19, 2024, 09:43:36 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


The '...' in variable argument functions

Started by Parker, November 11, 2005, 06:19:02 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Parker

In the other language, you had to declare printf with only one argument, the ... so it would look like declare cdecl extern _printf(...),string
but if I open Visual C++ and type the following code:extern "C" extern void printf(const char*,...);
extern "C" extern int _getch();

int main(void)
{
printf("Hi");
_getch();
return 0;
}
it compiles fine. In Aurora, the ... still requires that an argument be there. Can this be changed to match C?

Ionic Wind Support Team

Aurora isn't C, there will be many differences.  Variable parameters are handled differently by design.

You can declare printf with more than one argument, but that forces the format string.


declare cdecl import, printf(string format,...),string;
printf("%s","hi");


Or declare it without the format argument and you can use it either way


declare cdecl import, printf(...),string;
printf("%s","hi");
printf('hi");


In aurora there isn't much use for using printf without a format specifier since we have writeln which doesn't rely on the C library. And using which can be used to format a string.






Ionic Wind Support Team