Author Topic: Quick&dirty C++ language conformance tests  (Read 19705 times)

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Quick&dirty C++ language conformance tests
« Reply #15 on: December 18, 2005, 03:20:30 am »
Hmmm, the last two of the list return 1, but the first (throwing destructor) returns 0. Visual Studio C++ .NET 2003 and gcc version 3.4.4 (mingw special) gives the same results and behaves (for what I could see) in the same way.

Michael

grv575

  • Guest
Re: Quick&dirty C++ language conformance tests
« Reply #16 on: December 18, 2005, 04:32:42 am »
-O2 to the linker? 18%? I just tried that and the filesize is still the same.

-Wl,-O2

Am I missing something?

-Os optimizes size
and it doesn't need to be passed directly to the linker.
Still optimizing for speed is more important (-O2, -O3)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Quick&dirty C++ language conformance tests
« Reply #17 on: December 18, 2005, 03:27:39 pm »
-Os optimizes size
and it doesn't need to be passed directly to the linker.
I can only repeat: read the manual.

Quote
-O level
If  level  is a numeric values greater than zero ld optimizes the output.  This might take significantly longer and therefore
probably should only be enabled for the final binary.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

grv575

  • Guest
Re: Quick&dirty C++ language conformance tests
« Reply #18 on: December 18, 2005, 11:42:25 pm »
Code
man gcc says:

-O1 Optimize.
-O2 Optimize even more...performs nearly all supported optimizations that do not involve a space-speed tradeoff.
-O3 Optimize yet more.
-O0 Do not optimize.  This is the default.
-Os Optimize for size.  -Os enables all -O2 optimizations that do not typically increase code size.   It also performs further optimizations designed to reduce code size.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Quick&dirty C++ language conformance tests
« Reply #19 on: December 19, 2005, 12:01:05 am »
Try man ld  :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Quick&dirty C++ language conformance tests
« Reply #20 on: January 22, 2006, 04:28:07 pm »
If someone tried any of the ones MSVC 2005 fails, I would want to slap them for making me go  :? as I tried to read their code.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Quick&dirty C++ language conformance tests
« Reply #21 on: January 22, 2006, 05:33:30 pm »
If someone tried any of the ones MSVC 2005 fails, I would want to slap them for making me go  :? as I tried to read their code.

Which one for example?

Michael

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Quick&dirty C++ language conformance tests
« Reply #22 on: January 22, 2006, 05:35:27 pm »
If someone tried any of the ones MSVC 2005 fails, I would want to slap them for making me go  :? as I tried to read their code.

Which one for example?

Michael


Code
int main(int argc, char *argv[])
{
  int i = compl((2 bitor 4) xor 4) bitand 3;
  bool b = not ((true or false) and true);

  b and_eq true;
  b or_eq false;
  b xor_eq true;
  b not_eq not b;

  return 0;
}
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Quick&dirty C++ language conformance tests
« Reply #23 on: January 22, 2006, 05:49:33 pm »
Code
int main(int argc, char *argv[])
{
  int i = compl((2 bitor 4) xor 4) bitand 3;
  bool b = not ((true or false) and true);

  b and_eq true;
  b or_eq false;
  b xor_eq true;
  b not_eq not b;

  return 0;
}

Yes, I have to admit it has made me confusing too :D. Anyway, I like C++, because it can always surprise me with something I did not even know possible and therefore stimulate my desire to continue studying and using it.

Anyway, e.g., compl is an alternative to the ~ operator. The others are explained here.

Michael

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Quick&dirty C++ language conformance tests
« Reply #24 on: January 22, 2006, 06:16:36 pm »
Yes, I have to admit it has made me confusing too :D. Anyway, I like C++, because it can always surprise me with something I did not even know possible and therefore stimulate my desire to continue studying and using it.

Anyway, e.g., compl is an alternative to the ~ operator. The others are explained here.

Michael


No, no. compl is a way to get coworkers to  :x and then kill you. :lol:
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Quick&dirty C++ language conformance tests
« Reply #25 on: January 22, 2006, 06:22:05 pm »
No, no. compl is a way to get coworkers to  :x and then kill you. :lol:

Yes, it is a possible consequence :D.

Michael