------- Comment #3 from pinskia at gcc dot gnu dot org  2006-07-19 09:39 -------
This is a bug in your code and not in libobjc or GCC.
The correct code should look like:
#include <objc/Object.h>
#include <stdio.h>
#include <string.h>

int main()
{
    char s[80];
    char *d = s;
    strcpy(s,"Hi world");
    TypedStream* stream =
        objc_open_typed_stream_for_file("foo",OBJC_WRITEONLY);
    objc_write_type(stream, @encode(char*), &d); // crash here
    objc_close_typed_stream(stream);
    return 0;
}

&s is a pointer to an array and not a pointer to a pointer of chars.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28430

Reply via email to