42School / norminette

Official 42 norminette
MIT License
967 stars 142 forks source link

the multiplication operator is interpreted as a dereference #296

Open julien-alamelle opened 2 years ago

julien-alamelle commented 2 years ago

Describe the bug the multiplication operator is interpreted as a dereference in the following code

Erroneous code

double   zoom;
for (int i = 0; i < 9; ++i)
         data->subpix[i] = cpx((double)(i / 3 - 1) * zoom,
                 (double)(i % 3 - 1) * zoom);

t_cpx   cpx(double real, double imaginary);
//cpx take two double and create a t_cpx representing a complex number

Additional infos

Additional context done on 42lyon's mac

yumamur commented 8 months ago

typedef struct s_object { t_geometry geometry; t_material material; double (intersect)(t_ray ray, t_geometry geometry); t_v3 (normal)(t_v3 point, t_geometry geometry);// error here } t_object;

This is interesting. 'normal' function pointer raises 'missing space after operator' error at '*geometry', but the intersect does not. When the return type of 'normal' is changed to any of the primitive types, we get no errors. The same error is not seen if function pointers are replaced to global scope, probably any scope.