default value under linux

O

Onyxx

I kind of remember that in the following function signature, the optional input param will always be equal to its default value under Linux.

int funct(const int param = 1)
{

}
 
O

Onyxx

So basically the following function would always return 1 on Linux.

int funct(const int param = 1)
{
return param;
}

I think it is because the compiler is doing some optimization.

Or may be it was a similar case ... Does someone know in which situation this would happen ?
 
J

Jorgen Grahn

So basically the following function would always return 1 on Linux.

int funct(const int param = 1)
{
return param;
}

I think it is because the compiler is doing some optimization.

Or may be it was a similar case ... Does someone know in which
situation this would happen ?

It can only happen if you have a seriously broken compiler.
And it seems unlikely that g++ has had such a bug in the last decade,
although perhaps a superficially similar case could have.

Why are you asking, by the way? Are you really trying to ask about
something else, such as whether Linux is a useful platform, or g++ a
useful compiler?

/Jorgen
 
O

Onyxx

I remember vaguely a similar bug that I had on Linux but not on Windows. Itshould have been something different.

Thanks for the answer

Le jeudi 4 avril 2013 12:40:37 UTC+1, Jorgen Grahn a ?crit?:
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top