R
ramu
Hi,
Can we intialize va_list to NULL?
ie. va_list = NULL
Regards
Can we intialize va_list to NULL?
ie. va_list = NULL
Regards
ramu said:Can we intialize va_list to NULL?
ie. va_list = NULL
Probably not. va_list is "an object type suitable for holding
information needed by the macros va_start, va_arg, va_end, and va_copy";
it's unlikely to be a pointer type.
Probably not. va_list is "an object type suitable for holding
information needed by the macros va_start, va_arg, va_end, and
va_copy"; it's unlikely to be a pointer type.
What are you trying to accomplish?
--
Keith Thompson (The_Other_Keith) (e-mail address removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Miniss
ramu said:Sorry. I meant va_list ap=NULL;
Not va_list = NULL;
Please don't quote signatures (the stuff following the "-- " line)
unless you're actually commenting on them.
I assumed that was what you meant; I actually missed the fact that you
assigned a value to a type rather than to a variable.
But again, va_list is not necessarily a pointer type, and assigning a
null value to a va_list object, as far as I can tell, doesn't make any
sense.
And again, what are you trying to accomplish?
ramu said:Am getting Lint warning saying that variable is not
initialized. So am trying to initialize ap to NULL.
ramu said:Am getting Lint warning saying that variable is not initialized.
So am trying to initialize ap to NULL.
Keith said:Am getting Lint warning saying that variable is not initialized.
So am trying to initialize ap to NULL.
I'm guessing that you're getting a warning when you try to use it, not
on the declaration itself.
Initializing ap to NULL is not the solution to your problem. The way
to initialize ap (an object of type va_list) is to use the va_start
macro. Better yet, you should read the documetation (your textbook or
whatever) rather than just guessing.
Here's an example from the C99 standard:
#include <stdarg.h>
#define MAXARGS 31
void f1(int n_ptrs, ...)
{
va_list ap; [...]
va_start(ap, n_ptrs); [...]
If that doesn't help, please post your actual code and the exact text
of any warnings you get.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.