the bottom of the page below has one opinion why one style is superior to the other, (at least when it comes to C++ and the way C++ objects behave when going out of scope)

http://www.relisoft.com/book/lang/scopes/2local.html





On 28 Jun 2008, at 06:30, Alex Wait wrote:

I have noticed, coming from C++ and Visual Studio (at school), a
couple
style differences

if (value) {
   //do something
}

insteasd of

if (value)
{
   //do something
}

Also since I am using this style, XCode doesn't tab in for me when I
type {
then a return. This is the style I "taught" and I would like to
continue the
good habits
during the summer.

I learned C on Unix long before Microsoft had started producing
Windows 1.0. The first style was the first style I learned. I believe
it's called the K&R style (from the inventors of C) and it also seems
to be the preferred style in Java if you look in Sun's Java
documentation. When I then learned C++ back in 1988 (from Bjarne
Stroustrup, nonetheless), the K&R style was still the style being used.

The first time I came across the latter style was when I had to work
on some Windows C and C++ style. I believe the style was more or less
invented by Microsoft. Most of the Unix/Linux/Cocoa code I've worked
on has used the K&R style.

I personally prefer the K&R style as it is more compact. I can get a
better sense of the code on a screenful, while a larger portion of the
screen estate is consumed by syntactics (curly braces) that really
doesn't add much of a value in the latter style.

But it's mostly a matter of personal preference. Cocoa doesn't care
and neither does Xcode. You should be able to set up Xcode to indent
properly for you even when using the latter style. If it can't, file a
bug report on bugreporter.apple.com.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to