ROBOTC.net forums
http://www.robotc.net/forums/

RobotC 3.50 bug 6
http://www.robotc.net/forums/viewtopic.php?f=63&t=4849
Page 1 of 1

Author:  MHTS [ Wed Sep 19, 2012 7:51 am ]
Post subject:  RobotC 3.50 bug 6

The following code gave the compiler error:
**Error**:Calling procedure 'ObjInit'. Expression does not fit parameter. Parameter: 'unsigned short * pi'. Expression: '((void *) 0))'. Type: 'void *'
Code:
typedef struct
{
    int *pi;
} OBJ;

OBJ g_obj;

void ObjInit(OBJ *obj, int *pi)
{
    obj->pi = pi;
}

task main()
{
    ObjInit(&g_obj, NULL);
}

It looks like it doesn't like me passing NULL as a parameter to type int *.
I also tried to type cast it to:
Code:
    ObjInit(&g_obj, (int *)NULL);

But it gave me a different compiler error:
**Error**:'const' expression '(long *) ((void *) 0)))' cannot be used for non 'const' procedure parameter 'pi'

Author:  tfriez [ Sat Sep 22, 2012 8:06 pm ]
Post subject:  Re: RobotC 3.50 bug 6

This is definitely an issue that we will be resolving in the next build of ROBOTC.

One additional thing to note is that since ROBOTC is a "case-insensitive" language, that variable PI is a known language constant so that may cause issues in the future once the root caused is fixed.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/