Re: Strict aliasing and allocation functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Carsten,

How about this...

gcc -std=c99 -O3 -Wall -o x x.c

--------8<--------
#include <stdlib.h>
#include <stdio.h>

int alloc(size_t n, void* p)
{
    void* a;

    a = malloc(n);
    *(void**)p = a;
    return a == NULL;
}


int main(void) { int *a, res;

    res = alloc(10, &a);
    free(a);

    return 0;
}
-------->8--------

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux