Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Dec 1999
Offline Last Active Private

#5113515 What is the reason for making the leading entries all ones in a echelon form?

Posted by SiCrane on 01 December 2013 - 11:41 AM

It comes from the definition of row echelon form: what you get when you've finished the first part of Gaussian elimination. The people saying that the leading terms all need to be one are saying that you aren't really done with that first part until you've gotten the coefficients to one.

#5109659 Question on isometry

Posted by SiCrane on 16 November 2013 - 02:45 AM

I've seen this called three quarters view, but I've also seen three quarters view used to refer to other kinds of pseudo-3D rendering.

#5106162 Dividing by zero, on purpose

Posted by SiCrane on 31 October 2013 - 11:00 PM

The only time I've ever deliberately put a divide by zero into my code was to check if my exception handler was actually catching divide by zero and other non-C++ exceptions. 

#5105213 Does puzzle/platformer mean anything to you anymore?

Posted by SiCrane on 28 October 2013 - 05:38 PM

Personally I find it to be better than nothing. I'm rather tired of game descriptions that leave me no clue whatsoever what kind of game it is and whether or not I'll like it.

#5104841 program doesn't exit

Posted by SiCrane on 27 October 2013 - 01:57 PM

Did you try returning 0 from your window procedure when you process WM_DESTROY?

#5103811 How can I gain a deeper understanding of C/C++?

Posted by SiCrane on 23 October 2013 - 12:03 PM

For a lot of that, you'll want to read the actual C and C++ standards or at least the final draft versions of the various standards. It's hard to have a good language lawyer throw down about details without being able to refer to the standards.

#5102187 The Copy&Swap Idiom

Posted by SiCrane on 17 October 2013 - 11:29 AM

You may still want to include a self-assignment check, even though the code still works without one. For example, if you have 100 member variables, each of which is expensive to copy and/or swap, then this check will act as a healthy optimization.

Only if you perform enough self assignments to overcome the additional branch penalty for non-self assignment. I don't know what kind of code you're working on that has a significant amount of self assignment, but in my experience it's actually pretty rare. As always profile for specific cases, etc. but I would default to no self assignment check.

#5101932 Opinions on standard library <memory> use

Posted by SiCrane on 16 October 2013 - 02:38 PM

I wouldn't say it's necessarily bad, but shared ownership is used in a lot of cases where it's not needed, especially now in C++11 where move semantics mean that things like unique_ptr can be used where shared_ptr was in older code. Using it when it's not needed is a bad design choice.

#5101885 Opinions on standard library <memory> use

Posted by SiCrane on 16 October 2013 - 12:12 PM

I have also read articles by many programmers who offer dislike toward the shared_ptr (including Bjarn Stroustrup).

What Stroustrup dislikes is shared ownership, not shared_ptr per se. So shared_ptr is the symptom of the problem rather than the problem itself. He feels that if you have shared ownership you might as well use shared_ptr, but it's better not to have shared ownership in the first place.

#5101840 The Copy&Swap Idiom

Posted by SiCrane on 16 October 2013 - 09:21 AM

boost::swap will call std::swap() if ADL doesn't look-up swap() in the namespace of the arguments.

#5101811 The Copy&Swap Idiom

Posted by SiCrane on 16 October 2013 - 07:39 AM

Copy and swap isn't limited to C++ exceptions. It can be applied to many domains that have transaction safety requirements no matter what language and error reporting mechanism you use.

#5101797 The Copy&Swap Idiom

Posted by SiCrane on 16 October 2013 - 06:51 AM

Not really. std::swap is specialized for std::string to swap internals. You can also specialize std::swap for your own types as well. Ex:
template <> void std::swap(Foo & lhs, Foo & rhs) { lhs.swap(rhs); }

#5101581 glutTimerFunc question

Posted by SiCrane on 15 October 2013 - 11:05 AM

It's not very clear what you mean by parent function. When you call glutTimerFunc() you pass it a function pointer. When the GLUT main loop notices the requested amount of time has passed it calls that function pointer.

#5101094 2D octagonal tile map?

Posted by SiCrane on 13 October 2013 - 01:53 PM

No, there are other shapes that have monohedral tessellations. The Hirschhorn tiling, for example, uses a single pentagon shape. They just aren't useful for conventional game maps.

#5101047 goto considered harmful within global macros

Posted by SiCrane on 13 October 2013 - 09:54 AM

Really the thing that gets me most about this macro is that the name isn't in all caps. That's just wrong.