Re: What am I doing wrong?

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

    Re: What am I doing wrong?

    Ben Bacarisse said:
    Cromulent <cromulent@just extrememetal.co mwrites:
    >
    <snip>
    >>
    >int tokeniseInput(c har readstring[])
    >
    readstring is a pointer despite the []. C can't pass arrays and
    rather than forbid this syntax it was taken to mean the same as char
    *readstring in the context.
    No, that wasn't the reason, as a matter of fact. In the early days of C,
    pointers were described using [] rather than *. It wasn't long before the
    * was introduced, at which point [] was used exclusively for arrays,
    *except* in this situation - i.e. a function receiving a pointer as a
    parameter. Just why it was retained, I don't know - possibly a nod in the
    direction of backwards compatibility.

    --
    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
  • Ben Bacarisse

    #2
    Re: What am I doing wrong?

    Richard Heathfield <rjh@see.sig.in validwrites:
    Ben Bacarisse said:
    >
    >Cromulent <cromulent@just extrememetal.co mwrites:
    >>
    <snip>
    >>>
    >>int tokeniseInput(c har readstring[])
    >>
    >readstring is a pointer despite the []. C can't pass arrays and
    >rather than forbid this syntax it was taken to mean the same as char
    >*readstring in the context.
    >
    No, that wasn't the reason, as a matter of fact. In the early days of C,
    pointers were described using [] rather than *. It wasn't long before the
    * was introduced, at which point [] was used exclusively for arrays,
    *except* in this situation - i.e. a function receiving a pointer as a
    parameter. Just why it was retained, I don't know - possibly a nod in the
    direction of backwards compatibility.
    That's an interesting bit of history but it does not contradict
    anything I said. Image an historically accurate parenthetical remark
    "(when the * syntax was introduced to declare pointers)" between "and"
    and "rather". In other words, thank you for adding the context I left
    out, but did you have to start your answer with the word "no"?

    --
    Ben.

    Comment

    • Richard Heathfield

      #3
      Re: What am I doing wrong?

      Ben Bacarisse said:
      Richard Heathfield <rjh@see.sig.in validwrites:
      >
      >Ben Bacarisse said:
      >>
      >>Cromulent <cromulent@just extrememetal.co mwrites:
      >>>
      ><snip>
      >>>>
      >>>int tokeniseInput(c har readstring[])
      >>>
      >>readstring is a pointer despite the []. C can't pass arrays and
      >>rather than forbid this syntax it was taken to mean the same as char
      >>*readstring in the context.
      >>
      >No, that wasn't the reason, as a matter of fact. In the early days of C,
      >pointers were described using [] rather than *. It wasn't long before
      >the * was introduced, at which point [] was used exclusively for arrays,
      >*except* in this situation - i.e. a function receiving a pointer as a
      >parameter. Just why it was retained, I don't know - possibly a nod in
      >the direction of backwards compatibility.
      >
      That's an interesting bit of history but it does not contradict
      anything I said.
      Then I must have misunderstood what you said.

      <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

      Working...