Re: gnu extensions



Ben C <spamspam@xxxxxxxxx> writes:
["Followup-To:" header set to comp.programming.]

No, you set it to comp.lang.c.

On 2006-04-24, CBFalconer <cbfalconer@xxxxxxxxx> wrote:
Richard Tobin wrote:
CBFalconer <cbfalconer@xxxxxxxxxxxxx> wrote:

The aim, from a linguistic viewpoint, should be that there is
exactly one way of achieving any desired goal, and that that way
should be fairly obvious.

"The aim"? Whose aim? It's certainly not a generally accepted aim
among programming language designers.

As an example, consider the pain and anguish to newbies caused by
the C practice of passing arrays as a pointer to the first
element. This means that the parameter may be:

T *array
or
T[]

equally well (in the parameter header). This won't get changed,
nor am I recommending such. However a better language design would
provide only one such means.

Isn't the reason for this at least partly so you can write things like
this:

typedef int arr_t[3];

void f(arr_t a)
{
...
}

I don't think so. I'm fairly sure the use of [] for pointer
parameters predates the existence of typedef.

In fact, I think one of C's predecessors (B? BCPL?) used [] even for
pointer object declarations:

int p[]; /* declares ptr as a pointer to int */

although I agree it's pretty confusing. I tend to avoid array typedefs
myself.

Yup.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: gnu extensions
    ... "The aim"? ... among programming language designers. ... the C practice of passing arrays as a pointer to the first ... equally well (in the parameter header). ...
    (comp.programming)
  • Wanna see GWB fall flat on his face?
    ... Wanna see GWB fall flat on his face? ... Aim your pointer at him and then toss him around like a rag doll. ...
    (rec.music.gdead)
  • Re: A doubly linked-list in C
    ... about the way that parameters declared as having array type ... is `adjusted' to have pointer type. ... inability to find things in the standard implies ... standard that refers to passing arrays by their address, ...
    (comp.lang.c)
  • Re: Lileks does it again - Sears in 1973
    ... sorry about the vacant post - bad aim with the mouse pointer on my ... but since I'm here anyway -- thanks for the mondegreen clip, mike, ...
    (soc.motss)
  • Re: gnu extensions
    ... "The aim"? ... among programming language designers. ... equally well (in the parameter header). ... I tend to avoid array typedefs ...
    (comp.lang.c)