fb39ca4 / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Error when using void * type #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When i write script write script with void * pointer i get the following 
probleme:

void *adr2=(void *)0xC0000000; syntax is reject, 

                void *adr2=(void *)0xC0000000;
                                   ^
pointer_test.c:17: value not expected here

and the following syntax is rejected

                dumy((void *)0xC0000000);
                             ^
pointer_test.c:22: value not expected here

For the moment don't find any solution 

many thanks

Olivier

Original issue reported on code.google.com by olivier....@smardtv.com on 23 Aug 2010 at 7:16

Attachments:

GoogleCodeExporter commented 8 years ago
It is very annoying bug. Only workaround I have found - add native functions:
{ VoidFromInt,      "void*voidfromint(int);" },
{ IntFromVoid,      "int  intfromvoid(void*);" },
Example:
void stack_push(list*l,void*data);
int execselgosubcommand(char*line)
{
    CURRENTPOS++;
    stack_push(IPSTACK,voidfromint(CURRENTPOS));

    parseselect(line);
    processmessages();
    clearselectchoiceslist();
    return 1;
}

But I think it is not very good solution.

Dmitry

Original comment by demonmit...@rambler.ru on 4 Sep 2010 at 10:55

GoogleCodeExporter commented 8 years ago
Thanks. I'm looking into it.

Original comment by zik.sale...@gmail.com on 4 Sep 2010 at 12:00

GoogleCodeExporter commented 8 years ago
This turned out to be a problem with casts being recognised when they were at 
the top level of an expression evaluation, such as they are when they're 
function parameters.

Fixed in revision #483. 

Original comment by zik.sale...@gmail.com on 4 Sep 2010 at 1:41