From Newsgroup: comp.lang.c
i dont know how to name so i named it "c hole"
the problem is c seems not to be so optimal as people
says imo its releted to such problem (already talked on it by in fragments)
say you nedd to pass some structure like float3 vector
(quite typical bto my rasterizer code, hundreds of such passings)
or even much larger Object3D which have a lot of fields
i somewhat belived i may inline a lot of things but it showed
to be problematic - the size of exe really grows - so i may end
having 1 MB exe instead of 160 KB, yet antivirus claims)
so as i said i could pass foo(Object3D* o)
but on an user side i got a horrible amount of -> which is not only ugly
but is just wrong becouse its like access of pointer who can change
among calls (comiler would need to track if it not changes, and
its generally unoptimal)
the repair of it is somewhat c++ reference i belive (right now i wrote
my rasterizer (
https://www.youtube.com/watch?v=Bi7XPFZBwTE ) whole pure
c but i think i probbaly will compile in future in c++ mode and i will
try thise references ..as this pointer is not standable)
yet the better resolving of this problem would be just pass the
structures by hidden reference i mean no need to write its reference
Object3d o;
foo(Object3d o)
{
o.x = 20;
o.y = 19;
}
which i postulate for years (beats c++ reference imo, though c++
references bein better than pointers)
but now we got yet one problem what if you pass more structures than one
foo(Object3d o, Object3D p, float3 pos, float r)
{
}
somewhat i thinked that better calling convention would be to organize
things such way that maybe one should pass just one reference to
structure which arguments just make, but in fact thic could be
inpractical - like those 2 big objects would need memcopy which
probbaly is nontorelabe though someone could eventually make adhoc
helper structure with say 3 pointers and r value then it can just pass
one pointer (and this could be eventually worth rethinking)
other way would be just to make some other convention...
passing thru stack imo is also non tolerable so there is also option to
pass things like big fastcall like 7 args would need 7 registers
which can be too much..but there couled be chosem some more dynamic
convention eventually - like combining fastcall + this adhoc helper struct
it is yet to decide
all in all what now is in C is intorelable imo, this is simply trash
1) inlines dont work (except tiny functions)..2) pointers are non
standable 3) passing thru stack is bad 4) there is no finall good convention --- Synchronet 3.21e-Linux NewsLink 1.2