Re: [cc65] snapshot

Date view Thread view Subject view

From: Groepaz (groepaz_at_gmx.net)
Date: 2003-08-31 06:17:27


On Saturday 30 August 2003 13:36, Ullrich von Bassewitz wrote:
> On Sat, Aug 30, 2003 at 12:41:55AM +0200, Groepaz wrote:
> > > > - functions that return structs seem to translate correctly now (i
> > > > had to disable this before)
> >
> > this was supposed to mean "function that get structs as
> > parameters"...there were some hickups at some places before which are now
> > gone it seems
>
> This is not supposed to work either! While you can declare such a function,
> you aren't able to call it - at least this is how it is supposed to work
> and how it works in my tests. If you have really managed to pass a struct
> by value to a function, please send me the code, so I can make it
> non-working:-)

amazing :=P i'm going to run the tests again on tonite's snapshot and try to 
find out what happens there :=P

however...in order to locate some more quirks and for my own curiousity i 
started porting some raycasting engine....(really curious to see how fast, or 
better slow, it'd be :=P) i stumbled about the following so far...

1) i think this is c++ syntax (or a gnu extension?!), i dont remember :)

ok:

struct vec3_t
{
  int x, y, z;
};

not ok:

struct vec2_t
{
  int x,y;
};

struct vec3_t : vec2_t
{
  int z;
};

2)

ok:

void vector_init(struct vec3_t* v, int x, int y, int z)

not ok:

void vector_init(vec3_t* v, int x, int y, int z)

(with vec3_t defined as the working version in 1))

3)

#define FIXED_BITS 8
#define f2i(A) ((A) >> FIXED_BITS)
#define fixmul(A,B) f2i((A)*(B))

 m[0][0] = fixmul(singam,fixmul(sinbet,sinalp)) + fixmul(cosgam,cosalp);

 error: undefined symbol "FIXED_BITS"

nested macro(s) is the problem here i think :)

4)

ok:

void entity_to_world_collision(struct entity_t* e, int const radius);

not ok: compiles but causes errors later (wrong target pointer type in 
expression like (struct entity_t*)foo=e;

void entity_to_world_collision(struct entity_t* const e, int const radius);

there generally seem to be hickups with struct and const beeing used together 
in a declaretion..... btw is there a subtle difference between "const struct 
foo *bar" and "struct foo* const bar" ? i didnt even knew that the latter is 
legal c :=P

tjam...whatever :=)

gpz


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-08-31 06:21:53 CEST