• (cs)

    Wow. What a waste of time.

  • (cs)

    Mmm.... Perly!  However, I can't quite place that "ifnot" language feature.  What's that from?

  • bramster (unregistered)

    I never did like those pesky equal signs anyway.

    #define CURLY_OPEN_BRACE {


  • RanmaChan (unregistered)

    Hey, I want to see the whole file!  That is only part of a Better C!  Surely there must be something better than switch statements and structures!


  • (cs)

    Ugh, what a waste. It looks like he's trying to pull in some VB or SQL syntax. That makes sense, because it's so hard to remember ">" should be used for greater-than comparisons. Speaking of which, in a lot of places he replaced an operator (like ">") with a keyword that's longer than the original (now it's "GT").

    I say we send him hunting with Dick Cheney.

  • (cs)

    sweet, let's confuse everyone!!! I like to use BETTER_C++ it's my fav!!!

    while we're at it why don't we create BETTER_JAVA and oh, oh BETTER_VISUAL_BASIC, changing it all, talk about job security!!

  • Sam (unregistered)

    Oh, it's just personal preference.  He didn't like the syntax, so he changed it.  Big deal.

     

     

  • (cs) in reply to Manni
    Manni:

    Ugh, what a waste. It looks like he's trying to pull in some VB or SQL syntax. That makes sense, because it's so hard to remember ">" should be used for greater-than comparisons. Speaking of which, in a lot of places he replaced an operator (like ">") with a keyword that's longer than the original (now it's "GT").

    I say we send him hunting with Dick Cheney.

     

    that should be the new punishment for all bad programmers!! Cheap Oil and Better Programmers!!! ahh, a fantasy world ...

  • (cs)

    Awww, I saw the GT, GE, and LTs and thought FORTRAN.  Unfortunately those control structures don't look like they're from FORTRAN.  I was hoping there would finally be a WTF I could share with my co-workers.  :(

  • PiV (unregistered) in reply to Sam

    This is not a WTF, this is just someone using syntactical sugar type approach. No big deal. Who really cares?

  • (cs) in reply to Sam
    Anonymous:

    Oh, it's just personal preference.  He didn't like the syntax, so he changed it.  Big deal.

     

     



    Yeah, things are better off when everyone creates their own syntax.
  • (cs)

    Reminds me of Bournegol.

    http://www.goof.com/pcg/marc/bournegol.html

  • nTony (unregistered)

    what if he..
    #define pi 3.14159265............................................................

    omg....
    LOL

  • (cs) in reply to Sam

    "It's just personal preference" is something that should be kept at home for your fan fiction website, not for something that another sane human would have to maintain, as the submitter did. Now the maintainer has to re-interpret every "repeat { ... }untilforever" in the code into something that the rest of the C-speaking world understands without depending on kooky precompiler tricks.

    The WTF is why a person couldn't handle "<" or "while(1)" in their native format. I can only assume that they got "BETTER_C.h" from someone else; anyone with enough syntactic knowledge to write the header didn't need it in the first place.

  • (cs)

    Yeah, the NE, EQ, etc. are Perly. Then we have MOD, which is VBish.

    What's up with 'forever?' Where was he going to use <FONT face="Courier New">forever{ //do something}</FONT> ?

  • Fregas (unregistered)

    Can anyone say..."VB C"?

  • (cs) in reply to Sam
    One anonymous idiot:
    Oh, it's just personal preference.  He didn't like the syntax, so he changed it.  Big deal.

    Another anonymous moron:
    This is not a WTF, this is just someone using syntactical sugar type approach. No big deal. Who really cares?

    I have no doubt that you don't care. You'll start pulling your hair out when you inherit some code like this though.

  • uncool (unregistered)

    Alex Papadimoulis:
    #define forever   while(1)
    #define untilbreak forever
    #define untilreturn forever

     

    why didn't i think of that...

  • (cs)

    He was obviously trying to make C more self-documenting, which we all know is just an excuse for longer keywords that makes the language slower to code.

    The real WTF is that he used acronymns (GT, LT, EQ, NEQ, ...) instead of whole words (lessthan, greatherthan, equals, ...).

  • (cs)

    > # define do_nothing
    Priceless.

  • (cs) in reply to Sam
    Anonymous:

    Oh, it's just personal preference.  He didn't like the syntax, so he changed it.  Big deal.

     

     



    Congratulations, Sam, that is actually one of the biggest "WTF" comments we've seen here in a while.   yeah, all he did was CHANGE THE SYNTAX of the language ... no biggie.




  • (cs) in reply to RayMarron

    Um...found this lovely document:

    http://www.conman.org/software/amc/docs/html/amc_usersguide.html

    Full of lovely linguistic and grammatical WTFs itself to boot. It includes all of the operators listed.

  • (cs)

    Stupid VB programmers ... wait a second ... this isn't VB .... what is this?  C !?  how can that be?  All bad coders write in exclusively in VB, and bad code can only be written in VB!!  What the heck is going on?

  • (cs) in reply to stonguse

    <font size="2">I say we let him use it if he wants, but only if he renames it to I_am_an_incompetent_dumbass.h.

    </font>

  • The Bears (unregistered)

    The original Bourne shell takes this approach even further.

    Look at mac.h. Then look at args.c. Then go wash your brain out with vodka.

  • NoName (unregistered)

    Kids,

    the EQ, LT, GT etc. stuff is good old FORTRAN (sans leading and trailing '.').

    And attempts to use the preprocessor to rape C are not new. More than 15 years ago I first saw:

    #define BEGIN { #define END }

    and since then I have seen it a hundred times. There are just too many idiot programmers out there.

  • (cs)

    Sweet.  This is one of the de-facto obfuscation methods used by entrants to the International Obfuscated C Code Contest

  • (cs) in reply to wintermyute
    wintermyute:
    Sweet.  This is one of the de-facto obfuscation methods used by entrants to the International Obfuscated C Code Contest


    Exactly, but used for the opposite purpose.
  • ChiefEngineer (unregistered) in reply to PiV

    May be the guys who will have to keep his code up to date in the future?

    I'm sure they WILL care about it...

  • anonymous (unregistered) in reply to uncool

    You're sane.

  • (cs) in reply to Jeff S
    Jeff S:
    Anonymous:

    Oh, it's just personal preference.  He didn't like the syntax, so he changed it.  Big deal.

     

     



    Congratulations, Sam, that is actually one of the biggest "WTF" comments we've seen here in a while.   yeah, all he did was CHANGE THE SYNTAX of the language ... no biggie.




     

    I dunno, I'm having a hard time caring about it either. Although lately I've been messing with Ruby a lot, so maybe it's just that some of the resulting constructs are familiar. (Ruby has syntax built in for constructs like button.push unless thesign.says("Please do not push this button again").

     

    But dude, seriously. He needed to reserve "forever"... AND <FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>untilbreak, AND untilreturn?</FONT>

    And a construct called do_nothing? 

    (Incidentally: some of those comparison operators look Perlish, but they're not used appropriately. EQ and == aren't equivalent, for example: one compares strings, the other numeric values.)

  • boogieman (unregistered)

    Reminds me of my software engineering professor.  He was convinced that C was the worst thing ever conceived.

    And yet he said the language would be a hundred times better if we added the following lines to the top of our code:

    #define BEGIN {
    #define END }

  • (cs) in reply to R.Flowers
    R.Flowers:

    Yeah, the NE, EQ, etc. are Perly. Then we have MOD, which is VBish.

    What's up with 'forever?' Where was he going to use <font face="Courier New">forever{ //do something}</font> ?



    excerpt of cruise_missile_guidance_system.c...

    pos p = starting_position(), p_old, target = acquire_target();

    do {
        p_old = p;
        p = gps_query();
        trajectory t = vector(p_old, p);
        correction c = calculate_course(target, p, t);
        adjust_course(c);
    } forever;

  • ChiefCrazyTalk (unregistered) in reply to SeekerDarksteel
    SeekerDarksteel:

    Awww, I saw the GT, GE, and LTs and thought FORTRAN.  Unfortunately those control structures don't look like they're from FORTRAN.  I was hoping there would finally be a WTF I could share with my co-workers.  :(

     

    Looks like a half-FORTRAN, half Pascal hybrid super-language.

  • (cs) in reply to Maurits

    #define COMMENT //

  • ChiefEngineer (unregistered) in reply to PiV

    Anonymous:
    This is not a WTF, this is just someone using syntactical sugar type approach. No big deal. Who really cares?

    May be the guys who will have to keep his code up to date in the future?

    I'm sure they WILL care about it...

  • (cs)

    #define    lAlpha    a
    #define    lIndia    I
    #define    sComma    ,
    #define    sPeriod    .
    #define    wBel    believe
    #define    wBet    Better_C
    #define    wCan    can't
    #define    wComp    competitive
    #define    wEd    edge
    #define    wEn    enable
    #define    wGv    give
    #define    wGy    guys
    #define    wI    is
    #define    wImprov    improvements
    #define    wjt    just
    #define    wkd    kind
    #define    wM    me
    #define    wNd    need
    #define    wO    of
    #define    wSea    see
    #define    wT    to
    #define    wTech    technology
    #define    wTh    the
    #define    wThs    this
    #define    wTht    that
    #define    wTng    thing
    #define    wU    you
    #define    wWl    will

    wTht wBet wTech wI wjt wTh wkd wO wTng wTht lIndia wNd wT wGv wM lAlpha wComp wEd sPeriod
    lIndia wCan wBel wTht wU wGy wCan wSea wTh wkd wO wImprov wTht wThs wWl wEn sPeriod

  • (cs)

    He's on the right track. Operators are works of the Devil. Weird, mysterious symbols, like Pagan runes. Must be Satan worshipping.

    #define ASSIGN(x,y) (x) = (y)
    #define ADD(x,y) (x) + (y)
    #define SUBTRACT(x,y) (x) - (y)
    #define MULTIPLY(x,y) (x) * (y)
    #define DIVIDE(x,y) (x) / (y)
    #define INCREMENT(x,y) (x) += (y)
    #define INCREMENT1(x) INCREMENT(x,1)
    #define POINTEROF(x) &(x)
    #define THATPOINTEDBY(x) *(x)
    #define MEMBEROF(x,y) (x).(y)
    #define STOP ;

    ASSIGN(a,MULTIPLY(MEMBEROF(THATPOINTEDBY(b),c),INCREMENT1(d))) STOP

    And so much easier to read by the next generation of programmers.

    Wait, I forgot:

    #define BEGINPARENTHESES (
    #define ENDPARENTHESES )
    #define SEPARATOR ,

    --Rank

  • ChiefEngineer (unregistered) in reply to ZeoS

    ZeoS:
    #define COMMENT //

    Great!

    Should be added:

    #define COMMENT_START     /*

    #define COMMENT _END        */

  • (cs) in reply to Rank Amateur

    #define CONCATENATE_LITERAL_STRINGS(x, y) x y

  • ChiefCrazyTalk (unregistered) in reply to ZeoS

    ZeoS:
    #define COMMENT //

     

    you mean #define REM //

  • Stern (unregistered)

    Any idea why the board software insists on putting all code on a single line in the RSS feed (except the obvious donkey-cock suckage which comes as a built-in feature)?

  • (cs)

    OMG! more defines come to my head

    #define macro define
    #macro . ;    COMMENT every statement should finish with .

  • (cs) in reply to ChiefCrazyTalk

    I'm taking a C class right now, can I get the full file so I can force the grading TAs to wash their eyes out with acid?

  • (cs) in reply to Rank Amateur
    Rank Amateur:

    He's on the right track. Operators are works of the Devil. Weird, mysterious symbols, like Pagan runes. Must be Satan worshipping.

    #define ASSIGN(x,y) (x) = (y)
    #define ADD(x,y) (x) + (y)
    #define SUBTRACT(x,y) (x) - (y)
    #define MULTIPLY(x,y) (x) * (y)
    #define DIVIDE(x,y) (x) / (y)
    #define INCREMENT(x,y) (x) += (y)
    #define INCREMENT1(x) INCREMENT(x,1)
    #define POINTEROF(x) &(x)
    #define THATPOINTEDBY(x) *(x)
    #define MEMBEROF(x,y) (x).(y)
    #define STOP ;

    ASSIGN(a,MULTIPLY(MEMBEROF(THATPOINTEDBY(b),c),INCREMENT1(d))) STOP

    And so much easier to read by the next generation of programmers.

    Wait, I forgot:

    #define BEGINPARENTHESES (
    #define ENDPARENTHESES )
    #define SEPARATOR ,

    --Rank



    Don't you mean

    #define (x) PLUS (y)   (x) + (y)
    #define (x) TIMES (y)   (x) * (y)
    #define (x) MINUS (y)   (x) - (y)
    #define (x) DIVIDEDBY (y)   (x) / (y)

    I especially appreciate STOP.
  • Chris (unregistered) in reply to mrsticks1982

    I believe those are called C# and VB.NET.

    [dons flame suit]

  • (cs) in reply to ZeoS
    ZeoS:
    OMG! more defines come to my head

    #define macro define
    #macro . ;    COMMENT every statement should finish with .


    I meant

    #macro . ;   REM every statement should finish with .
  • Chris (unregistered) in reply to mrsticks1982
    mrsticks1982:

    while we're at it why don't we create BETTER_JAVA and oh, oh BETTER_VISUAL_BASIC, changing it all, talk about job security!!



    I believe those are called C# and VB.NET.

  • (cs) in reply to Fregas

    Anonymous:
    Can anyone say..."VB C"?

    No, but I can say VB++

  • (cs) in reply to Chris

    The real WTF is that there are people still programing in C

Leave a comment on “The Secret to Better C”

Log In or post as a guest

Replying to comment #:

« Return to Article