Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > default value under linux

Reply
Thread Tools

default value under linux

 
 
Onyxx
Guest
Posts: n/a
 
      04-04-2013
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)
{

}
 
Reply With Quote
 
 
 
 
Onyxx
Guest
Posts: n/a
 
      04-04-2013
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 ?
 
Reply With Quote
 
 
 
 
Jorgen Grahn
Guest
Posts: n/a
 
      04-04-2013
On Thu, 2013-04-04, Onyxx wrote:
> 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

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Onyxx
Guest
Posts: n/a
 
      04-04-2013
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?:
> On Thu, 2013-04-04, Onyxx wrote:
>
> > 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
>
>
>
> --
>
> // Jorgen Grahn <grahn@ Oo o. . .
>
> \X/ snipabacken.se> O o .


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
report on building of python 2.5.2 under msys under wine on linux. Luke Kenneth Casson Leighton Python 0 01-15-2009 09:48 PM
Re: Is Netscape Leaving Firefox Behind on GNU/Linux? THE LINUX PROPAGANDA MACHINE CONTINUES. FIREFOX IGNORING LINUX............. traci.manicotti@gmail.com Computer Support 2 10-20-2007 02:12 PM
help : my jar file is not running under linux terminal , but it runs under JbuilderX ide bronby Java 1 07-15-2005 07:23 AM
Using default a empty dictionary as a default value C Gillespie Python 3 03-22-2005 12:22 PM
Java application developped under Linux running ridiculously slow under Windows hshdude Java 12 11-04-2004 05:49 PM



Advertisments