Thread: instructor situation.

  1. #16
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    using brackets in the argument list is pretty non-standard, even if it will compile and is technicalyl correct. Your professor is wrong, it is ansi, but it does present a readability issue, since most people trying to read yoru code would be confused for a few milliseconds at what you are doing. The real test is whether -

    Code:
    void foo(int []);
     
    void main(void){  // i love you ***** :D
       int* bar = NULL;
     
       foo(bar);
       }
    will compile. if you can't use [] in a forward declaration without the variable name, and if the compiler wont accept it as synonymous rather than an overloaded function, then [] is incorrect.

  2. #17
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Are you seeing diagnostic messages with that code?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #18
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    i can't believe I'm seeing that again.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #19
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Dave_Sinkula View Post
    Are you seeing diagnostic messages with that code?
    Of course he does:
    temp.c: In function `main':
    temp.c.4: error: `NULL' undeclared (first use in this function)
    temp.c.4: error: (Each undeclared identifier is reported only once
    temp.c.4: error: for each function it appears in.)
    temp.c.3: warning: return type of `main' is not `int'

  5. #20
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Yeah, copy-paste is a mother.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #21
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    If your boss (head developer / technical lead) told you to use the pointer declaration (or to do some other task their way), would you question their ability / understanding? [I hope not.]

    Sometimes I want something done a particular way (and have a very good reason) but don't want to spend the 15-30 minutes explaining the specifics it to a new staff member who is not experienced in real world systems/conditions.


    Quote Originally Posted by NeonBlack View Post
    Mario, maybe I exaggerated a little with the "vast majority" thing, but it seems like it is more common (among the people I know anyway).
    I agree with Mario.

    I do not use the array declaration and I have not seen many professional C programmers that do.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #22
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by novacain View Post
    If your boss (head developer / technical lead) told you to use the pointer declaration (or to do some other task their way), would you question their ability / understanding? [I hope not.]

    Sometimes I want something done a particular way (and have a very good reason) but don't want to spend the 15-30 minutes explaining the specifics it to a new staff member who is not experienced in real world systems/conditions.
    And fair enough, but would you give an obviously false reason and expect it to go by?

  8. #23
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    It's cool now- I was working today and he just happened to be passing by as the computer froze. The computer just completely locked up for some reason. He asked me 'What the hell happened?' I told him I didn't know. 'Probably because of the damn array notation in your prototypes.' We both had a good laugh and he went on his way.

    He must have been having a bad day.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

Popular pages Recent additions subscribe to a feed