inline functions and argument lists

J

jamihuq

Hello all,
I just wondering if the following is supported in C:

inline char* myfunc(unsigned int aLen, char *aFormat, ...)

Thanks
Jami
 
K

Keith Thompson

jamihuq said:
Hello all,
I just wondering if the following is supported in C:

inline char* myfunc(unsigned int aLen, char *aFormat, ...)

inline is only supported in C99 (though some pre-C99 compilers may
support it as an extension). Other than that, I don't see any problem
with it.
 
J

Jaspreet

Keith said:
inline is only supported in C99 (though some pre-C99 compilers may
support it as an extension). Other than that, I don't see any problem
with it.

As for ... (ellipse) that refers to variable argument lists, yes that
is also supported in almost all compilers. (Haven't seen any C compiler
not supporting it).
 
B

Ben Pfaff

Jaspreet said:
As for ... (ellipse) that refers to variable argument lists, yes that
is also supported in almost all compilers. (Haven't seen any C compiler
not supporting it).

All C compilers support it, in that any compiler that does not
support it is not a C compiler.
 
K

Keith Thompson

Jaspreet said:
As for ... (ellipse) that refers to variable argument lists, yes that
is also supported in almost all compilers. (Haven't seen any C compiler
not supporting it).

That feature has been in the language since the 1989 ANSI standard
(equivalent to the 1990 ISO standard). It's almost certainly no
longer necessary to worry about old compilers that don't support at
least that standard.
 
J

Jordan Abel

All C compilers support it, in that any compiler that does not
support it is not a C compiler.

Unless it's a pre-ansi one. The compiler on unix v7 didn't have variadic
arguments.
 
K

Keith Thompson

Jordan Abel said:
Unless it's a pre-ansi one. The compiler on unix v7 didn't have variadic
arguments.

At least not in their current form. Before ANSI introduced
<stdarg.h>, there was a <varargs.h> header which could be used to
implement things like printf(); some systems still support it.
(Unless Unix V7 predates printf().)
 
J

Jordan Abel

At least not in their current form. Before ANSI introduced
<stdarg.h>, there was a <varargs.h> header which could be used to
implement things like printf(); some systems still support it.
(Unless Unix V7 predates printf().)

v7 did not use macros to implement printf - it used messy pointer
arithmetic directly.
 
P

pemo

jamihuq said:
Hello all,
I just wondering if the following is supported in C:

inline char* myfunc(unsigned int aLen, char *aFormat, ...)

Looks ok if you're using a c99 compliant compiler for the /inline/ bit.

However, you do know that on 'inline': it's just necessary for a compiler to
*not* produce a syntax error when it sees it, i.e., as long as it recognises
the keyword, it doesn't have to pay it any further attention.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top