Re: AfxGetApp() returns NULL
- From: "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Dec 2007 19:23:29 GMT
"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote in message
news:B6163C57-D14D-426B-B862-EC4A3138A67A@xxxxxxxxxxxxxxxx
Hi David,
I think that the style of formatting code is as subjective as anything can
get in our business. I've worked with people that absolutely believe that
God intended us to use the format:
if (...)
{
}
else
{
}
And I go to the church of more real estate and use:
if (...) {
}
else {
}
I also do this a lot:
if (...)
// One line of code
else
// One other line of code
I would put the else on the same line as the closing brace for the
previous if, but that is *too* difficult to read. The thing I like the
least is when people use this format:
if (...)
{
}
else
{
}
But, like I said, everyone has their preferences. Kind of makes you with
K&R had imposed a format from the beginning. I've found that a good way
to get to know code that I inherit is to reformat it. It makes me go
through each line and think about all the blocks.
Hi Tom, sure these are all common indentation themes that are readily
supported by programmer's editors, and it is no big deal to go from one to
another one of these. The IDE lets you do that. But when Joe knocks it for
not out-of-the-box supporting his entirely non-standard indentation style
(have you ever heard of indenting one space past the brace?) and then calls
the IDE a third rate editor because of things like this, I want to get the
point across that it is his expectations that are more out of line with
reality than the IDE's shortcomings. While I would grudgingly tolerate code
to be checked in that followed any one of the formats you illustrate,
because they are at least standard, I would insist Joe's code be reformatted
prior to checking it into the codebase since it is too much to ask other
team members to get used to this entirely non standard code style.
I agree that reformatting the code is a good way to learn it, and after
reformatting it, stepping through in the debugger is even more helpful.
Cheers,
David
.
- Follow-Ups:
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: Tom Serface
- Re: AfxGetApp() returns NULL
- References:
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Joseph M . Newcomer
- Re: AfxGetApp() returns NULL
- From: David Ching
- Re: AfxGetApp() returns NULL
- From: Tom Serface
- Re: AfxGetApp() returns NULL
- Prev by Date: Re: More Colours for CFontDialog
- Next by Date: Re: bool or BOOL in MFC projects
- Previous by thread: Re: AfxGetApp() returns NULL
- Next by thread: Re: AfxGetApp() returns NULL
- Index(es):
Relevant Pages
|