• 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: C question for you old guys ;-)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C question for you old guys ;-)


  • Subject: Re: C question for you old guys ;-)
  • From: Jay Vaughan <email@hidden>
  • Date: Wed, 11 Jun 2003 12:54:36 +0200

On Tuesday, June 10, 2003, at 01:23 AM, Jay Vaughan wrote:
I don't like them, and I'm not only not going to use them, I'm
going to see to it that anyone I know doesn't promote their use as
well! It's a terrible thing to do!

Sorry, but your approval is neither sought nor required.


Neither case is required in order for my 'approval' to be proferred, and my opinion on this matter is certainly not contingent on your authority ...

I'm not offering approval for you anyway, I'm cautioning the leagues of programmers on this list you have tainted with bad programming advice.

Don't offer new programmers bad advice just because it reflects some 'programmer cool'. It reflects poorly on your "Senior Cocoa Software Engineer" status more than anything. If you were truly senior, you would understand the problems this 'hack' promotes in a project.

Anyway I know I'm going to be wary of your proferred 'solutions' on cocoa-dev in the future, since you seem to be more interested in hacks that make things 'easier' than actual good work examples, and you certainly haven't thought about this #define issue in the context of what it might do to your developer community.

If I am browbeating you about it (and boring cocoa-dev with this) it is because you just don't seem to get it, and my opinion is that someone in your position *should* understand this and should not be promoting bad programming habits among a demographic which is here to learn good ones.

You happen to be in a position where people will listen to you - why teach them bad things?

You can't deny that sloppy habits exist,

Sure they do, and this is not one of them.


Sorry, but 'fixing' the (val == CONSTANT) vs. (val = CONSTANT) problem with a #define like you suggest is a sloppy habit and a poor use of C.


The reason it is a bad habit is that if I see someone doing that in code on a project I'm working on, I can only wonder what *ELSE* was #define'd to make the code readable ... and short of inspecting the entire cooked pre-processor output myself personally throughout the entire project, there would be no way of making for sure that I didn't miss some stupid pre-processor hack buried somewhere which changes the way everything 'looks' just to make it easier to 'read'.

It might be cool, but it is definitely *BAD*.

Complete chaos *has* happened, and *does* happen, if you promote language-semantic modification with the pre-processor in any large'ish demographic of programmers. This completely invalidates the purpose of the pre-processor in the first place, which is to safely make code more readable!


The truly senior lesson here, off-topic for cocoa-dev but relevant since cocoa-dev originated the thread that started this all, is simple:

*READ* your code, people. Don't just blankly stare at it and assume you think you know what you're doing with it, no matter how 'senior' you are. Programmer arrogance is fatal! It takes a humble pass of code to spot the difference between '=' and '==', and nothing else.

And, despite what John C. Randolph says, using #define to make things 'easier' for you to avoid having to read your code *IS* a bad habit.

READ the code. Don't just stare at it. And for gods sake, please don't use #define to make changes to language semantics!!!!


(Why yes, having written a few millions of lines of C code in my life, I *am* a C Zealot. Thanks very much for noticing ... and sorry for clogging cocoa-dev with my boring rhetoric.)

--

;

Jay Vaughan
r&d>>music:technology:synthesizers - www.access-music.de/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: C question for you old guys ;-)
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: C question for you old guys ;-) (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: troubling article
  • Next by Date: Re: troubling article
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: C question for you old guys ;-)
  • Index(es):
    • Date
    • Thread