Hello all,
I just wondering if the following is supported in C:
inline char* myfunc(unsigned int aLen, char *aFormat, ...)
Thanks
Jami 8 1588
"jamihuq" <ja*********@ya hoo.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_Keit h) 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.
Keith Thompson wrote: "jamihuq" <ja*********@ya hoo.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_Keit h) 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).
"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
"Jaspreet" <js***********@ gmail.com> writes: Keith Thompson wrote: "jamihuq" <ja*********@ya hoo.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_Keit h) 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.
On 2006-03-01, Ben Pfaff <bl*@cs.stanfor d.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.
Jordan Abel <ra*******@gmai l.com> writes: On 2006-03-01, Ben Pfaff <bl*@cs.stanfor d.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_Keit h) 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.
On 2006-03-01, Keith Thompson <ks***@mib.or g> wrote: Jordan Abel <ra*******@gmai l.com> writes: On 2006-03-01, Ben Pfaff <bl*@cs.stanfor d.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.
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
============== This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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. accessor and mutator methods to
access private data members). I would like to know if there are any issues
with using inline functions that may have attributed to my errors before I
start separting them out into "outline functions".
Regards
|
by: Richard Hayden |
last post by:
Hi,
I have the following code:
/******************************** file1.c
#include <iostream>
extern void dummy();
inline int testfunc() {
|
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 read
many authors (and it's my belief, too) who discourage the use of the
'inline' keyword, because:
- The 'inline' word only advice the compiler about wich functions should be
expanded, but not force it to expand them. Also, the compiler can...
|
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;
|
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 the one I am using (NULL in this
example) or an argument count parameter (ugh).
The following function concatenates a series of C-style strings. I am
aware of the fact that not allocating enough memory for `dst` results
in UB (gave me a...
| |
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 would expect to see
it inlined during linkage of the two object files. Does inlining only
occur if the inline function is defined within the same file that it is
called?
Thanks,
|
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
the function, and from there, treat it sort of like a template function?
For instance, if we had a template function like so:
template<class T>
T GetAverage(T a, T b);
|
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 write type generic functions macros?
#define CUBE(I) ( (I) * (I) * (I) )
Is there some more concise set of things where inline functions should
be used instead of macros? Multi-statement macros, for example?
|
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
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |