473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

inline functions and argument lists

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

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

Thanks
Jami

Feb 28 '06 #1
8 1559
"jamihuq" <ja*********@yahoo.com> writes:
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Feb 28 '06 #2
Keith Thompson wrote:
"jamihuq" <ja*********@yahoo.com> writes:
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.


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).

Mar 1 '06 #3
"Jaspreet" <js***********@gmail.com> writes:
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.
--
"Am I missing something?"
--Dan Pop
Mar 1 '06 #4
"Jaspreet" <js***********@gmail.com> writes:
Keith Thompson wrote:
"jamihuq" <ja*********@yahoo.com> writes:
> 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.


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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Mar 1 '06 #5
On 2006-03-01, Ben Pfaff <bl*@cs.stanford.edu> wrote:
"Jaspreet" <js***********@gmail.com> writes:
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.


Unless it's a pre-ansi one. The compiler on unix v7 didn't have variadic
arguments.
Mar 1 '06 #6
Jordan Abel <ra*******@gmail.com> writes:
On 2006-03-01, Ben Pfaff <bl*@cs.stanford.edu> wrote:
"Jaspreet" <js***********@gmail.com> writes:
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.


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().)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Mar 1 '06 #7
On 2006-03-01, Keith Thompson <ks***@mib.org> wrote:
Jordan Abel <ra*******@gmail.com> writes:
On 2006-03-01, Ben Pfaff <bl*@cs.stanford.edu> wrote:
"Jaspreet" <js***********@gmail.com> writes:

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.


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().)


v7 did not use macros to implement printf - it used messy pointer
arithmetic directly.
Mar 1 '06 #8
jamihuq wrote:
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.

--
==============
Not a pedant
==============
Mar 1 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: A | last post by:
Hi, I'm having problems completing a project in C++. I have been using inline functions in some of my header files. I have only done so for simple functions that only have 1 statement (eg....
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
21
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've...
3
by: Peteris Krumins | last post by:
Hello, Is it possible to use va lists if i prefare to define functions as following: (won't compile) void die(file, line, fn, fmt, ...) const char *file;
5
by: Jonathan Burd | last post by:
Greetings everyone, I wrote a function to learn about variable-length argument lists. I wonder if there is a better way to detect the end of the argument list than using a sentinel value like...
9
by: Bilgehan.Balban | last post by:
Hi, If I define an inline function in one .c file, and use it from another, after compiling and linking the two, it seems the function is not inlined but rather called as a regular function. I...
3
by: Tomás | last post by:
Let's say we have a variable length argument list function like so: unsigned GetAverage(unsigned a, unsigned b, ...); I wonder does the compiler go through the code looking for invocations of...
33
by: Robert Seacord | last post by:
When writing C99 code is a reasonable recommendation to use inline functions instead of macros? What sort of things is it still reasonable to do using macros? For example, is it reasonable to...
2
by: aaragon | last post by:
Hi everyone, I would like to create a very simple function: // header file inline void point_map() { PointMap pointMap = get(vertex_point_t(), g); } // main.cpp
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.