"row major" - technically no such thing in C?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lax

    "row major" - technically no such thing in C?


    Isn't it "technicall y" meaningless to call C a "row major language,"
    since there are no such things as multidimensiona l arrays in C.

    In C you can define arrays of arrays, and the way that the
    declarations work (first index closest to identifier defines the
    largest arrays) makes it seems like C has row-major multidimensiona l
    arrays

    No need to mention "row major" when discussing C if one talks about
    "arrays of arrays" and the way C's declarations work "inside to
    out." Correct, no?


    And thanks to Ian Collins and Walter Robinson for your help with my
    previous post (on 'static' externals).

  • Richard Heathfield

    #2
    Re: "row major" - technically no such thing in C?

    Lax said:
    >
    Isn't it "technicall y" meaningless to call C a "row major language,"
    since there are no such things as multidimensiona l arrays in C.
    3.3.2.1 of C89: "Successive subscript operators designate a member of a
    multi-dimensional array object."

    6.5.2.1(3) of C99: "Successive subscript operators designate an element of
    a multidimensiona l array object."

    <snip>

    --
    Richard Heathfield <http://www.cpax.org.uk >
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999

    Comment

    • Kenny McCormack

      #3
      Re: &quot;row major&quot; - technically no such thing in C?

      In article <G42dnTj5P6bqo5 zVRVnyhwA@bt.co m>,
      Richard Heathfield <rjh@see.sig.in validwrote:
      >Lax said:
      >
      >>
      >Isn't it "technicall y" meaningless to call C a "row major language,"
      >since there are no such things as multidimensiona l arrays in C.
      >
      >3.3.2.1 of C89: "Successive subscript operators designate a member of a
      >multi-dimensional array object."
      >
      >6.5.2.1(3) of C99: "Successive subscript operators designate an element of
      >a multidimensiona l array object."
      Nevertheless, it has been stated many times in this newgroup (by regs,
      including you; no, I'm not going to google it) that C does not have
      multidimensiona l arrays. It has been stated many times (yes, by you
      among others) that it has arrays of arrays.

      Of course, you claim that it doesn't have global variables, either...

      Comment

      • Andrey Tarasevich

        #4
        Re: &quot;row major&quot; - technically no such thing in C?

        Lax wrote:
        Isn't it "technicall y" meaningless to call C a "row major language,"
        since there are no such things as multidimensiona l arrays in C.
        C language implements the concept multidimensiona l arrays as arrays of arrays.
        It is absolutely incorrect to say that C doesn't have "multidimension al arrays".
        It does. The only contexts when a statement like that like that can be valid are
        the ones when the distinction between arrays of arrays and some other way of
        implementing multidimensiona l arrays is important.
        In C you can define arrays of arrays, and the way that the
        declarations work (first index closest to identifier defines the
        largest arrays) makes it seems like C has row-major multidimensiona l
        arrays
        No need to mention "row major" when discussing C if one talks about
        "arrays of arrays" and the way C's declarations work "inside to
        out." Correct, no?
        Yes, that and the additional assumption that the inner single-dimensional arrays
        represent specifically _rows_. Without such assumption, you'd only be able to
        call them first-index-major or left-index-major.


        --
        Best regards,
        Andrey Tarasevich

        Comment

        Working...