Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: November 1, 2026, 3:23 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom error message for stack overflow in C++
#31
RE: Custom error message for stack overflow in C++
HappySkeptic Wrote:You are still initializing the data in the constructor of TreeNode, every time. This is wasteful
I think both GCC and CLANG optimize that away. Namely, AECforWebAssembly v1.5.6 (the latest version) parses the Analog Clock example around 10 times faster than AECforWebAssembly v1.5 (before the recent changes).
Reply
#32
RE: Custom error message for stack overflow in C++
The initialization may be fast with some compilers, but it cannot be optimized away.
Reply
#33
RE: Custom error message for stack overflow in C++
(August 23, 2021 at 4:32 pm)HappySkeptic Wrote: The initialization may be fast with some compilers, but it cannot be optimized away.

Why?
Reply
#34
RE: Custom error message for stack overflow in C++
(August 25, 2021 at 3:32 pm)FlatAssembler Wrote:
(August 23, 2021 at 4:32 pm)HappySkeptic Wrote: The initialization may be fast with some compilers, but it cannot be optimized away.

Why?

You are telling the code to do the initialization work when constructing each new instance of the TreeNode class.  The compiler MUST force the program to do that work, because it cannot assume the data has not changed since the last time the work was done.
Reply
#35
RE: Custom error message for stack overflow in C++
Reply
#36
RE: Custom error message for stack overflow in C++
Okay, but at least you fixed that. It is too bad it didn't speed things up.

Just note - that this is an unsafe construct in a multi-threaded program (but yours isn't, so it is fine). With multi-threading, you have to use some sort of thread lock, not just a single variable.
Reply
#37
RE: Custom error message for stack overflow in C++
Reply
#38
RE: Custom error message for stack overflow in C++
Reply
#39
RE: Custom error message for stack overflow in C++
Reply
#40
RE: Custom error message for stack overflow in C++
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the most absurd error message a program you have made was outputting? FlatAssembler 38 15230 June 14, 2023 at 8:01 am
Last Post: FlatAssembler
  Error 502 bad gateway for Rational Responders Jackie 13 4174 April 23, 2022 at 4:17 pm
Last Post: BrianSoddingBoru4
  How Do I Send an SMS message From UK mobile to a US one ReptilianPeon 11 4199 July 9, 2018 at 5:17 pm
Last Post: bennyboy
  HELPPPPP Blue screen error just now!!! Edwardo Piet 114 26931 November 10, 2015 at 2:26 am
Last Post: Aractus
  Disk read error. Creed of Heresy 12 6196 July 27, 2012 at 9:19 am
Last Post: Tiberius
  Video Error: Grey circle with a white exclaimation mark inside. Reforged 5 5261 July 5, 2012 at 1:19 am
Last Post: Reforged



Users browsing this thread: 1 Guest(s)