C++ initialization mess

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: C++ initialization mess

Post by Love4Boobies »

gravaera wrote:Yo:

stripped

--Peace out
gravaera
I think I found your picture :lol:

Image
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
immibis
Posts: 19
Joined: Fri Dec 18, 2009 12:38 am

Re: C++ initialization mess

Post by immibis »

Owen wrote:The method that makes sense to me is...

Code: Select all

Class::Class()
{
    tryAndDoSomeInitializationStuff();
    if(thatFailed) throw SomeException(maybeWithSomeInformation);
}
i.e. using the language as intended, and letting RAII clean up afterwards
He said he didn't have support for exceptions. Since he said he wants to stop initialising (i.e. panic) if there's an error, I'd just do this: (where panic(const char*) is the kernel panic function that displays a message and loops forever)

Code: Select all

Class::Class()
{
    tryAndDoSomeInitializationStuff();
    if(thatFailed) panic("Unable to initialize stuff");
}
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: C++ initialization mess

Post by Brynet-Inc »

Love4Boobies wrote:I think I found your picture :lol:
Hey, that's racist.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: C++ initialization mess

Post by Solar »

What, the picture or the "Yo!"? 8)
Every good solution is obvious once you've found it.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: C++ initialization mess

Post by gravaera »

I think it's just a L4B thing :P
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Post Reply