Passing ellipsis to C

  • Thread starter Mike - EMAIL IGNORED
  • Start date
M

Mike - EMAIL IGNORED

Consider:

#include <syslog.h>

// Open syslog in constructor.

void
MyClass::
MyMemberFunction(...)
{
syslog(LOG_INFO,???);
}

Now I assume that syslog is a C function, using C type varargs, etc.
Is this correct? I want to pass the ellipsis to syslog. Can
I do this? How? I have heard that there might be an incompatibility.

Thanks for your help.
Mike.
 
V

Victor Bazarov

Mike said:
Consider:

#include <syslog.h>

There is no such standard header. If you want us to consider it, you
need to explain what it contains.
// Open syslog in constructor.

void
MyClass::
MyMemberFunction(...)
{
syslog(LOG_INFO,???);
}

Now I assume that syslog is a C function, using C type varargs, etc.

Why do you assume that? There is no such _standard_ C function.
Is this correct? I want to pass the ellipsis to syslog. Can
I do this? How? I have heard that there might be an incompatibility.

There is no way to pass "whatever arguments were passed to me" down to
some other function that is also declared with ellipsis. It is usually
done by calling a different function, which is made to accept 'va_list'.
See an implementation of 'printf' as an example.

V
 
L

Larry I Smith

Mike said:
Consider:

#include <syslog.h>

// Open syslog in constructor.

void
MyClass::
MyMemberFunction(...)
{
syslog(LOG_INFO,???);
}

Now I assume that syslog is a C function, using C type varargs, etc.
Is this correct? I want to pass the ellipsis to syslog. Can
I do this? How? I have heard that there might be an incompatibility.

Thanks for your help.
Mike.


Don't assume...
It is a C function that takes a format string (like printf).

Try 'man syslog' for details.

Seek help in one of the Linux development newsgroups
(comp.os.linux.development.apps or comp.os.linux.development.system).

Regards,
Larry
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top