Opened 7 years ago

Closed 7 years ago

#24 closed enhancement (fixed)

Non-compatible safety conversion (like C++), prevent void * to T *

Reported by: pabuhr Owned by: Rob Schluntz <rschlunt@…>
Priority: major Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

forall( otype T ) T * realloc( T *ptr, size_t n ) {
    return (T *)(void *)realloc( ptr, sizeof(T) );
}
int fred() {
    int *i;
    double *d;
    // need to change CFA so that T *p = void *p disallowed
    i = realloc( d, 2 );
}

Change History (2)

comment:1 Changed 7 years ago by a3moss

I think this is one for the new resolver...

...of course, I haven't added generic/pointer types to the prototype yet.

comment:2 Changed 7 years ago by Rob Schluntz <rschlunt@…>

Owner: set to Rob Schluntz <rschlunt@…>
Resolution: fixed
Status: newclosed

In cdbfab0:

Remove unsafe void * constructors and assignment operators from prelude [closes #24] [fixes #51]

Note: See TracTickets for help on using tickets.