由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to have another func call printf with va_arg list ?
相关主题
10个包子请教一个简单的编程问题python code performance --- normal or too slow?
一个面试题two general C++ question
gcc 编译的时候要包括 header source file 吗?很不习惯cin/cout
关于 c malloc的一个问题C++ formatted output question
python questionC#的formated output有点不方便呀。。。。
一个简单的算法问题?inline functions in C++
func调用结束时出错strlen怎么实现的
大家帮我看看这个C程序为什么出错了在 linux下有没有可能得到完全的fully static binary
相关话题的讨论汇总
话题: va话题: list话题: format话题: printf话题: arg
进入Programming版参与讨论
1 (共1页)
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...

1 (共1页)
进入Programming版参与讨论
相关主题
在 linux下有没有可能得到完全的fully static binarypython question
[合集] C里面return 1代表失败,return 0代表成功,对么?一个简单的算法问题?
问一个Visual Studio 2003 到 2005的问题func调用结束时出错
VC2005 C++ link error help大家帮我看看这个C程序为什么出错了
10个包子请教一个简单的编程问题python code performance --- normal or too slow?
一个面试题two general C++ question
gcc 编译的时候要包括 header source file 吗?很不习惯cin/cout
关于 c malloc的一个问题C++ formatted output question
相关话题的讨论汇总
话题: va话题: list话题: format话题: printf话题: arg