Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Tell the truth and run." -- Yugoslav proverb


devel / comp.lang.c / c bloat

SubjectAuthor
* c bloatfir
+* Re: c bloatfir
|`- Re: c bloatfir
`* Re: c bloatfir
 `- Re: c bloatfir

1
c bloat

<1d60491a-a6a6-4ad7-a918-3938f65e4693n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26053&group=comp.lang.c++#26053

  copy link   Newsgroups: comp.lang.c
 by: fir - Mon, 3 Jul 2023 14:29 UTC

c is considered not bloated langage somewhat right but if seen after many considerations c has bloat, (and bloat is imo linerly proportional to some code efficiency - not fully but for soem aspects of it) see for example function

void FillRotRectangle(float x, float y, float a, float w, float h, int c)
{ float dx = angle_x(a);
float dy = angle_y(a);
float gx = angle_x(a+90);
float gy = angle_y(a+90);

float b1x = x-h/2*dx + h/2*gx;
float b1y = y-h/2*dy + h/2*gy;

float b2x = x-h/2*dx - h/2*gx;
float b2y = y-h/2*dy - h/2*gy;

float b3x = x+(w-h/2)*dx - h/2*gx;
float b3y = y+(w-h/2)*dy - h/2*gy;

float b4x = x+(w-h/2)*dx + h/2*gx;
float b4y = y+(w-h/2)*dy + h/2*gy;

FillTriangle( b1x,b1y, b2x,b2y, b3x,b3y, c);
FillTriangle( b1x,b1y, b3x,b3y, b4x,b4y, c);
}

this is a function for drawing a rotated rectange, some kind of 'bar'
which may be rotated - this bar has rotation point in a point (h/2,h/2)
where h is height and is width of w

this function is proper c imo , only the names of variablex b1x, b1y etc are ugly but not see much fast what can be much improved here

but teroble bloat is present and conclusion is what i was already saying c need proper vector arithmetic to reduce thsi bloat, possibly it also need
what i recently called automatic bindung by names to further reduce it and yet maybe some slight tricks liek options to skip some typenames etc

maybe i will say more on thsi later

Re: c bloat

<7b27264f-d07c-45c4-8b30-98c879ac1c70n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26056&group=comp.lang.c++#26056

  copy link   Newsgroups: comp.lang.c
 by: fir - Mon, 3 Jul 2023 16:17 UTC

poniedziałek, 3 lipca 2023 o 16:29:57 UTC+2 fir napisał(a):
> c is considered not bloated langage somewhat right but if seen after many considerations c has bloat, (and bloat is imo linerly proportional to some code efficiency - not fully but for soem aspects of it) see for example function
>
> void FillRotRectangle(float x, float y, float a, float w, float h, int c)
> {
> float dx = angle_x(a);
> float dy = angle_y(a);
> float gx = angle_x(a+90);
> float gy = angle_y(a+90);
>
> float b1x = x-h/2*dx + h/2*gx;
> float b1y = y-h/2*dy + h/2*gy;
>
> float b2x = x-h/2*dx - h/2*gx;
> float b2y = y-h/2*dy - h/2*gy;
>
> float b3x = x+(w-h/2)*dx - h/2*gx;
> float b3y = y+(w-h/2)*dy - h/2*gy;
>
> float b4x = x+(w-h/2)*dx + h/2*gx;
> float b4y = y+(w-h/2)*dy + h/2*gy;
>
> FillTriangle( b1x,b1y, b2x,b2y, b3x,b3y, c);
> FillTriangle( b1x,b1y, b3x,b3y, b4x,b4y, c);
> }
>
> this is a function for drawing a rotated rectange, some kind of 'bar'
> which may be rotated - this bar has rotation point in a point (h/2,h/2)
> where h is height and is width of w
>
> this function is proper c imo , only the names of variablex b1x, b1y etc are ugly but not see much fast what can be much improved here
>
> but teroble bloat is present and conclusion is what i was already saying c need proper vector arithmetic to reduce thsi bloat, possibly it also need
> what i recently called automatic bindung by names to further reduce it and yet maybe some slight tricks liek options to skip some typenames etc
>
> maybe i will say more on thsi later

in co someone could write it

float2 cart(float a, float r){ return {angle_x(a)*r, angle_y(a)*r};}

void FillTriangle3P( float2 a, float2 b , float2 c, int color){ FillTriangle(a.x,a.y,b.x,b.y,c.x,c.y,color); }

float2 sum3f2(float2 a, float2 b, float2 c ){ return {a.x+b.x+c.x, a.y+b.y+c.y};}

void FillRotRectangle(float2 p, float a, float w, float h, int c)
{
float2 dr = cart(a+90, h/2);
float2 dl = cart(a-90, h/2);
float2 df = cart(a, w-h/2);
float2 db = cart(a+180, h/2);
FillTriangle3P(sum3f2(p,dr,db),sum3f2(p,dl,db), sum3f2(p,dl,df), c);
FillTriangle3P(sum3f2(p,dr,db),sum3f2(p,dl,df), sum3f2(p,dr,df), c);
}

but this function for sum is silly (that shows that function name 'overloading' on argument types and numbers is good idea, i mean it would be good if not make name clamping and destroing symbol simple names, so form ne which want to make symbols in c form its not to use i guess, even though i compile in c++ mode, but overally ofc this name overloading is a must)

this cart stand for to cartesian conversion where pol ould snad fot to polar conversion (as they are so many used the names should be rather short)
imo improved c should have something like point2 structure with automatic conversions

hovevevr thsi yeild to funny topic if such structure should hold values as two cartesian {x,y }or two polar {fi, r} - not in functions i tend to use angle first module later, which is probably right - or if it should use last used and a bit flag which form it is currently and change it only on conversions

Re: c bloat

<95c33cfd-5fb8-4bad-861d-c002fa6b12bcn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26057&group=comp.lang.c++#26057

  copy link   Newsgroups: comp.lang.c
 by: fir - Mon, 3 Jul 2023 16:29 UTC

poniedziałek, 3 lipca 2023 o 18:18:02 UTC+2 fir napisał(a):
> poniedziałek, 3 lipca 2023 o 16:29:57 UTC+2 fir napisał(a):
> > c is considered not bloated langage somewhat right but if seen after many considerations c has bloat, (and bloat is imo linerly proportional to some code efficiency - not fully but for soem aspects of it) see for example function
> >
> > void FillRotRectangle(float x, float y, float a, float w, float h, int c)
> > {
> > float dx = angle_x(a);
> > float dy = angle_y(a);
> > float gx = angle_x(a+90);
> > float gy = angle_y(a+90);
> >
> > float b1x = x-h/2*dx + h/2*gx;
> > float b1y = y-h/2*dy + h/2*gy;
> >
> > float b2x = x-h/2*dx - h/2*gx;
> > float b2y = y-h/2*dy - h/2*gy;
> >
> > float b3x = x+(w-h/2)*dx - h/2*gx;
> > float b3y = y+(w-h/2)*dy - h/2*gy;
> >
> > float b4x = x+(w-h/2)*dx + h/2*gx;
> > float b4y = y+(w-h/2)*dy + h/2*gy;
> >
> > FillTriangle( b1x,b1y, b2x,b2y, b3x,b3y, c);
> > FillTriangle( b1x,b1y, b3x,b3y, b4x,b4y, c);
> > }
> >
> > this is a function for drawing a rotated rectange, some kind of 'bar'
> > which may be rotated - this bar has rotation point in a point (h/2,h/2)
> > where h is height and is width of w
> >
> > this function is proper c imo , only the names of variablex b1x, b1y etc are ugly but not see much fast what can be much improved here
> >
> > but teroble bloat is present and conclusion is what i was already saying c need proper vector arithmetic to reduce thsi bloat, possibly it also need
> > what i recently called automatic bindung by names to further reduce it and yet maybe some slight tricks liek options to skip some typenames etc
> >
> > maybe i will say more on thsi later
> in co someone could write it
>
>
> float2 cart(float a, float r){ return {angle_x(a)*r, angle_y(a)*r};}
>
> void FillTriangle3P( float2 a, float2 b , float2 c, int color){ FillTriangle(a.x,a.y,b.x,b.y,c.x,c.y,color); }
>
> float2 sum3f2(float2 a, float2 b, float2 c ){ return {a.x+b.x+c.x, a.y+b.y+c.y};}
>
> void FillRotRectangle(float2 p, float a, float w, float h, int c)
> {
> float2 dr = cart(a+90, h/2);
> float2 dl = cart(a-90, h/2);
> float2 df = cart(a, w-h/2);
> float2 db = cart(a+180, h/2);
> FillTriangle3P(sum3f2(p,dr,db),sum3f2(p,dl,db), sum3f2(p,dl,df), c);
> FillTriangle3P(sum3f2(p,dr,db),sum3f2(p,dl,df), sum3f2(p,dr,df), c);
> }
>
> but this function for sum is silly (that shows that function name 'overloading' on argument types and numbers is good idea, i mean it would be good if not make name clamping and destroing symbol simple names, so form ne which want to make symbols in c form its not to use i guess, even though i compile in c++ mode, but overally ofc this name overloading is a must)
>
> this cart stand for to cartesian conversion where pol ould snad fot to polar conversion (as they are so many used the names should be rather short)
> imo improved c should have something like point2 structure with automatic conversions
>
> hovevevr thsi yeild to funny topic if such structure should hold values as two cartesian {x,y }or two polar {fi, r} - not in functions i tend to use angle first module later, which is probably right - or if it should use last used and a bit flag which form it is currently and change it only on conversions

eventually it should be simple float2 but polar and cartesian should be just cast operators

Re: c bloat

<5de4f242-0506-496b-87b1-970fe353c6dcn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26058&group=comp.lang.c++#26058

  copy link   Newsgroups: comp.lang.c
 by: fir - Mon, 3 Jul 2023 17:01 UTC

poniedziałek, 3 lipca 2023 o 16:29:57 UTC+2 fir napisał(a):
> c is considered not bloated langage somewhat right but if seen after many considerations c has bloat, (and bloat is imo linerly proportional to some code efficiency - not fully but for soem aspects of it) see for example function
>
> void FillRotRectangle(float x, float y, float a, float w, float h, int c)
> {
> float dx = angle_x(a);
> float dy = angle_y(a);
> float gx = angle_x(a+90);
> float gy = angle_y(a+90);
>
> float b1x = x-h/2*dx + h/2*gx;
> float b1y = y-h/2*dy + h/2*gy;
>
> float b2x = x-h/2*dx - h/2*gx;
> float b2y = y-h/2*dy - h/2*gy;
>
> float b3x = x+(w-h/2)*dx - h/2*gx;
> float b3y = y+(w-h/2)*dy - h/2*gy;
>
> float b4x = x+(w-h/2)*dx + h/2*gx;
> float b4y = y+(w-h/2)*dy + h/2*gy;
>
> FillTriangle( b1x,b1y, b2x,b2y, b3x,b3y, c);
> FillTriangle( b1x,b1y, b3x,b3y, b4x,b4y, c);
> }
>

in fact more logical yet would be to define function FillQuad so
rewritting this above would be

void FillRotRectangleEx(float2 p, float a, float w, float h, int c)
{
float2 dr = cart(a+90, h/2), dl = cart(a-90, h/2), df = cart(a, w-h/2), db = cart(a+180, h/2),
FillQuad4P( p+dr+db, p+dl+db, p+dl+df, p+dr+df;, c);
}

and this is ok...only if c would support basic vector arithmetic..comitee sleeps in that respect and thsi they could add (i mean int2 int3 int4 float2, float3 flot4 types and basic arithmetic on this

Re: c bloat

<7082af53-2376-48d2-a7fc-b041c2062940n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26059&group=comp.lang.c++#26059

  copy link   Newsgroups: comp.lang.c
 by: fir - Mon, 3 Jul 2023 17:10 UTC

poniedziałek, 3 lipca 2023 o 19:02:00 UTC+2 fir napisał(a):
> poniedziałek, 3 lipca 2023 o 16:29:57 UTC+2 fir napisał(a):
> > c is considered not bloated langage somewhat right but if seen after many considerations c has bloat, (and bloat is imo linerly proportional to some code efficiency - not fully but for soem aspects of it) see for example function
> >
> > void FillRotRectangle(float x, float y, float a, float w, float h, int c)
> > {
> > float dx = angle_x(a);
> > float dy = angle_y(a);
> > float gx = angle_x(a+90);
> > float gy = angle_y(a+90);
> >
> > float b1x = x-h/2*dx + h/2*gx;
> > float b1y = y-h/2*dy + h/2*gy;
> >
> > float b2x = x-h/2*dx - h/2*gx;
> > float b2y = y-h/2*dy - h/2*gy;
> >
> > float b3x = x+(w-h/2)*dx - h/2*gx;
> > float b3y = y+(w-h/2)*dy - h/2*gy;
> >
> > float b4x = x+(w-h/2)*dx + h/2*gx;
> > float b4y = y+(w-h/2)*dy + h/2*gy;
> >
> > FillTriangle( b1x,b1y, b2x,b2y, b3x,b3y, c);
> > FillTriangle( b1x,b1y, b3x,b3y, b4x,b4y, c);
> > }
> >
> in fact more logical yet would be to define function FillQuad so
> rewritting this above would be
>
> void FillRotRectangleEx(float2 p, float a, float w, float h, int c)
> {
> float2 dr = cart(a+90, h/2), dl = cart(a-90, h/2), df = cart(a, w-h/2), db = cart(a+180, h/2),
> FillQuad4P( p+dr+db, p+dl+db, p+dl+df, p+dr+df;, c);
> }
>
> and this is ok...only if c would support basic vector arithmetic..comitee sleeps in that respect and thsi they could add (i mean int2 int3 int4 float2, float3 flot4 types and basic arithmetic on this

this shows btw how much bloat is c without vector arithmetic usuing vectors - its just twice the code (.x .y) in that aspect, possibly using 3d vectors it is triple

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor