View Single Post
  #29  
Old March 27th, 2004, 08:32 PM
Cainehill's Avatar

Cainehill Cainehill is offline
Lieutenant General
 
Join Date: Mar 2004
Location: Albuquerque New Mexico
Posts: 2,997
Thanks: 0
Thanked 0 Times in 0 Posts
Cainehill is on a distinguished road
Default Re: Best (CD Bootable?) Linux Distro for Dominions?

Quote:
Originally posted by Norfleet:
quote:
Originally posted by alexti:
Can you declare in the "if" expression?
I don't think I've ever even thought to try anything so horrendously ugly. My old-style C habits cause me to do all my declaring up top.

Eh. The benefit of declaring them inside the if statement (or for statement) is that they go out of scope as soon as the if or for is exitted. Keeps you from polluting the namespace with what is, after all, throwaway variables that are only used for a helpful side effect. And you get better locality of reference by declaring variables when used, rather than at the top of a function, unless the variables are relevant through most of the function.

Oh, another reason for not declaring them inside the if or for is that Microsoft's compilers don't give the proper lifetime/scope with the default compiler switches; with the switches set to force proper behavior, you can no longer compile Microsoft's header files. (This may be fixed with the latest .Net compilers.)
__________________
Wormwood and wine, and the bitter taste of ashes.
Reply With Quote