s*****w 发帖数: 1527 | 1 so it's like
myprintf(fmt, ...)
{
printf(fmt, ...);
}
use va_list ? | t****t 发帖数: 6806 | 2 void myprintf(const char* format, ...)
{
va_list va;
va_start (va, format);
vprintf(format, va);
}
【在 s*****w 的大作中提到】 : so it's like : myprintf(fmt, ...) : { : printf(fmt, ...); : } : use va_list ?
| s*****w 发帖数: 1527 | 3 can you do this ?
void myprintf1(const char* format, ...)
{
va_list va;
va_start (va, format);
myprintf2(format, va); // still use ... in prototype
}
void myprintf2(const char* format, ...)
{
va_list va;
va_start (va, format);
vprintf(format, va); // not ...
}
【在 t****t 的大作中提到】 : void myprintf(const char* format, ...) : { : va_list va; : va_start (va, format); : vprintf(format, va); : }
| t****t 发帖数: 6806 | 4 if you explicitly use va_list to call, you declare a parameter with va_list
type.
"..." is used to accept indefinite number of parameters, while "va_list"
only accept one parameter. they are totally different. the connection is,
you use type va_list to enumerate (indefinite number of) parameters in "..."
, since "..." doesn't have a name.
i see you do not have a clear understanding of c language. i am afraid it's
almost impossible to port a libc in 1 month given that...
【在 s*****w 的大作中提到】 : can you do this ? : void myprintf1(const char* format, ...) : { : va_list va; : va_start (va, format); : myprintf2(format, va); // still use ... in prototype : } : void myprintf2(const char* format, ...) : { : va_list va;
| s*****w 发帖数: 1527 | 5 sigh, i have working as sw engineer for too long,
hate it so much and just want go back to my math major.
Data mining and AI is much more fun than writing a CRT.
list
."
s
【在 t****t 的大作中提到】 : if you explicitly use va_list to call, you declare a parameter with va_list : type. : "..." is used to accept indefinite number of parameters, while "va_list" : only accept one parameter. they are totally different. the connection is, : you use type va_list to enumerate (indefinite number of) parameters in "..." : , since "..." doesn't have a name. : i see you do not have a clear understanding of c language. i am afraid it's : almost impossible to port a libc in 1 month given that...
|
|