Thread: sizeof pointer-to-array -- &array

  1. #16
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by josemariasola
    OK, that's right for MS, but does that also goes for Borland?

    Maybe I'm beeing a little naive, but I carefully configured both, Borland and MS, compilers to conform to ANSI C 90 and to emit all possible warnings.

    Should I just accept it's a bug?

    Joey.
    Borland, from my experience, likes to play by their own rules. Some of the most complained about compilers in the history of the language come from Borland. In my opinion, if it isn't from GNU, it's not worth using. Microsoft is the closest exception to that, that I know of.
    Sent from my iPadŽ

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >But is it possible that both companies be wrong on this same subject for so long?
    Yes. It's a subtle and rarely displayed bug in one of the rare exceptions to the rule. Because of that, 1) it's very easy to make that mistake, 2) it's unlikely to be noticed, and 3) it might not be important enough to justify the cost of fixing. So the bug could easily exist through several versions of different compilers.
    My best code is written with the delete key.

  3. #18
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Quote Originally Posted by Prelude
    3) it might not be important enough to justify the cost of fixing. So the bug could easily exist through several versions of different compilers.
    I know my company has taken that stance with a couple bugs. Click a button a little to fast on one of the schematic loading pages and you get a nice error... so we just have a warning. We could go back and revise that section, but there are other more pressing maters for us to work on.

  4. #19
    Registered User
    Join Date
    Jul 2006
    Posts
    5
    Quote Originally Posted by Dave_Sinkula
    Thanks for the link. What I'm failing to interpret is if discarding or not the & in sizeof &a is an implementation defined behavior.

    Joey.

  5. #20
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by josemariasola
    Thanks for the link. What I'm failing to interpret is if discarding or not the & in sizeof &a is an implementation defined behavior.
    With what others such as Lawrence Kirby said in that thread, and Prelude and others have said in this one, I'd go with, "No, it's broken".
    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.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why does C need pointer conversion
    By password636 in forum C Programming
    Replies: 2
    Last Post: 04-10-2009, 07:33 AM
  2. sorting with pointer of pointers to array
    By dunpealslyr in forum C++ Programming
    Replies: 6
    Last Post: 10-01-2007, 11:26 PM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. pointer to multidimensional array
    By Bigbio2002 in forum C++ Programming
    Replies: 4
    Last Post: 02-05-2006, 10:29 PM
  5. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM