View unanswered posts | View active topics It is currently Sat Oct 25, 2014 12:17 am






Reply to topic  [ 2 posts ] 
RobotC 3.50 bug 5 
Author Message
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post RobotC 3.50 bug 5
The following code would compile in an ANSI-C compiler but RobotC rejected it.
Code:
typedef struct
{
    int n1;
    int n2;
} OBJ, *POBJ;

void Func1(POBJ obj)
{
    nxtDisplayTextLine(0, "n1=%d", obj->n1);
    nxtDisplayTextLine(1, "n2=%d", obj->n2);
}

task main()
{
    OBJ obj;
   
    obj.n1 = 1;
    obj.n2 = 2;
    Func1(&obj);
}

Then, I tried the following. RobotC rejected that too.
Code:
typedef struct
{
    int n1;
    int n2;
} OBJ;
typedef OBJ *POBJ;

void Func1(POBJ obj)
{
    nxtDisplayTextLine(0, "n1=%d", obj->n1);
    nxtDisplayTextLine(1, "n2=%d", obj->n2);
}

task main()
{
    OBJ obj;
   
    obj.n1 = 1;
    obj.n2 = 2;
    Func1(&obj);
}

However, the following worked as expected.
Code:
typedef struct
{
    int n1;
    int n2;
} OBJ;

void Func1(OBJ *obj)
{
    nxtDisplayTextLine(0, "n1=%d", obj->n1);
    nxtDisplayTextLine(1, "n2=%d", obj->n2);
}

task main()
{
    OBJ obj;
   
    obj.n1 = 1;
    obj.n2 = 2;
    Func1(&obj);
}

So I guess I am just picky on ANSI-C compliance :) Not high priority.


Wed Sep 19, 2012 5:47 am
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 613
Post Re: RobotC 3.50 bug 5
Hi Michael - We appreciate your feedback as always :).

We'll take a look at conforming to the true ANSI-C compliance for type-defs. I apologize that we weren't able to fit this modification in for the 3.51 release, but we'll make sure it makes it into a future release.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Sat Sep 22, 2012 8:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.