From: Keith Thompson on
Vladimir Jovic <vladaspams(a)gmail.com> writes:
> Scott Lurndal wrote:
>> I personally place the condition operator at the front, as
>> William does, but nested.
>>
>> if ((pointer1 != NULL)
>> && (pointer1->field7 == 0x152)) {
>> return;
>> }
>
> if ( ( pointer1 =! NULL )
> && ( pointer1->field7 = 0x152 ) ) {
> return;
> }
>
> ops && ops

if ( pointer1 != NULL &&
pointer1->field7 == 0x152 )
{
return;
}

I put the opening brace on the same line as the "if" if it fits.
If it doesn't, I put it on a line by itself, so it doesn't get lost.
It's probably not entirely consistent, but it works well for me.

Note that I also dropped some extraneous parentheses. Too many
parentheses can be as confusing as too few, and I think it's
sufficiently obvious that "==" and "!=" bind more tightly than "&&".
The alignment of the subexpressions helps.

I do not suggest that my style is the only correct one.

--
Keith Thompson (The_Other_Keith) kst-u(a)mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
From: Malcolm McLean on
On Mar 3, 7:55 pm, Keith Thompson <ks...(a)mib.org> wrote:
>
> Note that I also dropped some extraneous parentheses.  Too many
> parentheses can be as confusing as too few,
>
I use the rule of three. Three levels of indirection, three dimensions
in an array, or three nested parentheses. (Some people will realise
that threse are different ways of saying the same thing).


From: Ian Collins on
Malcolm McLean wrote:
> On Mar 3, 3:01 pm, Lorenzo Villari <vll...(a)tiscali.it> wrote:
>> I have to ask: what's the point nowadays of using a text mode only
>> editor, apart from hardware restrictions and years of use? I guess
>> that's "Masochistic answers to Stylistic questions on UNIX C coding"...
>>
> A lot of big computers still don't have windowing systems. Their
> cycles are too expensive to be used on updating GUIs.

There are also a lot of small computers still don't have windowing
systems. We don't edit code on those either. We edit code on our
choice of desktop system.

--
Ian Collins
From: Ian Collins on
Ersek, Laszlo wrote:
> In article <20100303140159.04b04a3e(a)kubuntu>, Lorenzo Villari <vlllnz(a)tiscali.it> writes:
>> On Tue, 02 Mar 2010 17:27:13 -0500
>> Joe Wright <joewwright(a)comcast.net> wrote:
>>
>>> It's WordStar for Unix. It's well written and functional. Why would
>>> you be revolted by it? What's wrong with a DOS editor? 1980 was a
>>> really great year. Get a grip.
>>>
>>> My most used editor on Windows is EDIT.COM and on Unix of course, vi.
>>> I do use the GUI IDE from Visual FoxPro but normally write C and
>>> xBASE from the command line with EDIT.
>>>
>> I have to ask: what's the point nowadays of using a text mode only
>> editor, apart from hardware restrictions and years of use? I guess
>> that's "Masochistic answers to Stylistic questions on UNIX C coding"...
>
> One point might be "screen real estate"
>
> http://www.usabilityfirst.com/glossary/term_573.txl
>
> aka "no clutter".

Use a bigger screen!

I'm sure the developers of Eclipse and NetBeans must all use 30" panels...

--
Ian Collins
From: Seebs on
On 2010-03-03, Ian Collins <ian-news(a)hotmail.com> wrote:
> There are also a lot of small computers still don't have windowing
> systems. We don't edit code on those either. We edit code on our
> choice of desktop system.

Sometimes. Actually, 99% of my editing is done remotely, so I use plain
text editors, because they let me do important things, like preserve an
editor session while travelling, or through several reboots, and so on.
Even when I'm working locally, I edit in a text editor in a shell, usually.
I find the convenience of the tools and environments and the faster interface
to be a win.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
First  |  Prev  |  Next  |  Last
Pages: 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
Prev: integer
Next: shared memory question