• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Style Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Style Question


  • Subject: Re: Style Question
  • From: Sam Mo <email@hidden>
  • Date: Sat, 28 Jun 2008 09:39:14 -0400

On Jun 28, 2008, at 4:54 AM, Robert Claeson wrote:

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 got the impression that the latter style was rooted from Pascal (or even Algo) programmers where they usually place the "begin" and "end" on separate lines.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Style Question
      • From: Rob Ross <email@hidden>
References: 
 >Style Question (From: "Alex Wait" <email@hidden>)
 >Re: Style Question (From: Robert Claeson <email@hidden>)

  • Prev by Date: trackmouse problems in Leopard
  • Next by Date: Re: Why aren't my bindings firing?
  • Previous by thread: Re: Style Question
  • Next by thread: Re: Style Question
  • Index(es):
    • Date
    • Thread