473,320 Members | 1,612 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,320 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 3590
* 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Anh-Tu Vo | last post by:
Hi all, I have a weird problem on a variable assignment. It seems that the variable is only updated with the value at the second time the function is called. My program looks like this: ...
12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
41
by: JKop | last post by:
I was doing some Win32 programming today, having to include the file "windows.h". Anyway, I'm thinking of writing a program that'll work like so: macrodestroyer.exe windows.h What this program...
7
by: Ganny | last post by:
Is it possible to write a template function min that takes variable number of arguments? It should be without using ugly C var args, arrays, or statically overloading the method for N arguments....
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
12
by: rjtucke | last post by:
Hi all- this is my first post here- just a quick question: #include <math.h> double foo = cosh(0.621); int main() { return 0; } fails with
3
by: Thomas Pajor | last post by:
Hey everybody, I got into serious trouble with template programming. I have a class which uses three template arguments, say template<typename Atype, typename Btype, typename Ctype> class...
13
by: S James S Stapleton | last post by:
I have some code, and I want to make it future-resistant. I have a bunch of variables that are set up run-time, and once set up, should act as constants. I don't want to #define them, because their...
21
by: Christian Meier | last post by:
Hello NG I have the following code: file1.h: static const int iValue = 5; <EOF>
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.