471,066 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Variable Arguments and inline function.

Neo
Hi All,
Can I write a variable argument function as inline function? and will
it be inline always? if not, can I force it to be line on all platforms.

Nov 24 '06 #1
4 3453
* Neo:
Hi All,
Can I write a variable argument function as inline function?
Yes. But there are seldom good reasons to use "...". It's in a
category under 'goto' among things not to use (except for compile time
code).

and will it be inline always?
Depends on the compiler etc.

>if not, can I force it to be line on all platforms.
Depends on the compiler etc.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 24 '06 #2
Neo
Let me define my problem neatly.

I want a function say

Log(param1,param2,...)
param1= compulsory
param2=compulsory
.... = any

Purpose of this function is to log any general info.
Also __FILE__ and __LINE__ macros will be inside this function.

Now this function should expand at a place where it is used so that
__FILE__ and __LINE__ macros will work properly. That made me to think
of "inline".
Also I should able to use variable arguments and I want this function
as a member of one class.
Thanks
Vikram S


Alf P. Steinbach wrote:
* Neo:
Hi All,
Can I write a variable argument function as inline function?

Yes. But there are seldom good reasons to use "...". It's in a
category under 'goto' among things not to use (except for compile time
code).

and will it be inline always?

Depends on the compiler etc.

if not, can I force it to be line on all platforms.

Depends on the compiler etc.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 24 '06 #3
Neo
Let me define my problem neatly.

I want a function say

Log(param1,param2,...)
param1= compulsory
param2=compulsory
.... = any

Purpose of this function is to log any general info.
Also __FILE__ and __LINE__ macros will be inside this function.

Now this function should expand at a place where it is used so that
__FILE__ and __LINE__ macros will work properly. That made me to think
of "inline".
Also I should able to use variable arguments and I want this function
as a member of one class.
Thanks
Vikram S


Alf P. Steinbach wrote:
* Neo:
Hi All,
Can I write a variable argument function as inline function?

Yes. But there are seldom good reasons to use "...". It's in a
category under 'goto' among things not to use (except for compile time
code).

and will it be inline always?

Depends on the compiler etc.

if not, can I force it to be line on all platforms.

Depends on the compiler etc.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 24 '06 #4
Hi Neo

IMHO you should use a macro rather than a inline function, since inline
is merely a request (far as i know ) and up to the compiler to decide.

it could be something like

#define Log(...) logger(__FILE__, __LINE__, ...)

hope it helps

iftekhar

Neo wrote:
Let me define my problem neatly.

I want a function say

Log(param1,param2,...)
param1= compulsory
param2=compulsory
... = any

Purpose of this function is to log any general info.
Also __FILE__ and __LINE__ macros will be inside this function.

Now this function should expand at a place where it is used so that
__FILE__ and __LINE__ macros will work properly. That made me to think
of "inline".
Also I should able to use variable arguments and I want this function
as a member of one class.
Thanks
Vikram S


Alf P. Steinbach wrote:
* Neo:
Hi All,
Can I write a variable argument function as inline function?
Yes. But there are seldom good reasons to use "...". It's in a
category under 'goto' among things not to use (except for compile time
code).

and will it be inline always?
Depends on the compiler etc.

>if not, can I force it to be line on all platforms.
Depends on the compiler etc.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 24 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Anh-Tu Vo | last post: by
41 posts views Thread by JKop | last post: by
23 posts views Thread by Russ Chinoy | last post: by
12 posts views Thread by rjtucke | last post: by
13 posts views Thread by S James S Stapleton | last post: by
21 posts views Thread by Christian Meier | last post: by
reply views Thread by leo001 | last post: by

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.