Re: on allowing "int a" definition everywhere

Liste des GroupesRevenir à l c 
Sujet : Re: on allowing "int a" definition everywhere
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.c
Date : 27. Aug 2024, 22:02:15
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <7d84a6c77a2ee958c0f2a08e4fac248e5ad7aea8@i2pn2.org>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
fir wrote:
Bart wrote:
On 27/08/2024 19:44, fir wrote:
fir wrote:
>
on fictional snippet (probebly not working)
>
void draw_line( float x, float y, float x2, float y2, unsigned color)
{
     float
      wx=dist(x,x2),wy=dist(y,y2); int m=wx<wy?wx:wy;
      float dx=wx/m,dy=wy/m;for(int
i=0;i<(int)m;i++)set_pixel(x+=dx,y+=dy,color);
}
>
thin skin
>
draw_line`x`y`x2`y2`color
{
     `wx=dist x x2,`wy=dist y y2,`M=(wx<wy?wx!wy)
     `dx=wx/m,`dy=wy/m, M'set_pixel x+=dx y+=dy color;
}
>
though eventualy it canm be written shorter i guess
>
  draw_line`x`y`x2`y2`color:
  `m = min 'wx=abs x2-x 'wy=abs y2-y) ' set_pixel x+=wx/m y+=wy/m color;
  ;
>
not to say it lookin specially good but welll..
>
There are ways to have more compact syntax without it turning weird,
leaving out types, and using backtick separators and other strange
punctuation (or is that lone ')' a typo?).
>
Start with this version:
>
   void draw_line( float x, float y, float x2, float y2, unsigned color)
   {
       float
        wx=dist(x,x2),wy=dist(y,y2); int m=wx<wy?wx:wy;
        float
dx=wx/m,dy=wy/m;for(inti=0;i<(int)m;i++)set_pixel(x+=dx,y+=dy,color);
  }
>
For example:
>
    void draw_line(f32 x, y, x2, y2; u32 colour) {
        f32 wx = dist(x, y2), wy = dist(y, y2)
        int m = min(wx, wy)
        repeat m {
            set_pixel(x += wx/m, y += wy/m, colour)
        }
    }
>
Summary:
>
- Allow shared types in parameter lists
- Auto semicolon insertion
- Built-in 'min/max' operators
- New repeat-n-times loop
- Shorter type names
>
yes there were typos and mistakes
its more like
>
  draw_line`x1`y1`x2`y2`color:
   `m = min abs x2-x1 abs y2-y1 ' set_pixel x1+=(x2-x1)/m y1+=(y2-y1)/m
color;
;
>
with some 'cheats as i both float and unsigned gere note by ` but ascii
has to narow charset amd i dont know unicode enough (though probably i
could look into unicode and chose some
>
• draw_line`x1`y1`x2`y2`color:
   `m= x2‾x1 ˩ y2‾y1 ' set_pixel x1+=(x2-x1)/m y1+=(y2-y1)/m color;

there are some unicode characters that could be handy for example this bullet ••••• above is good
this ˩ ˩ ˩ ˩ ˩  is also ok ...i would need probably to chose somethink like 20-30 potentially best to add - but today my eyesight quite bad so some other day

Date Sujet#  Auteur
20 Aug 24 * on allowing "int a" definition everywhere62fir
20 Aug 24 +* Re: on allowing "int a" definition everywhere24Thiago Adams
20 Aug 24 i+* Re: on allowing "int a" definition everywhere4fir
20 Aug 24 ii+- Re: on allowing "int a" definition everywhere1fir
20 Aug 24 ii`* Re: on allowing "int a" definition everywhere2Thiago Adams
20 Aug 24 ii `- Re: on allowing "int a" definition everywhere1fir
21 Aug 24 i`* Re: on allowing "int a" definition everywhere19Blue-Maned_Hawk
21 Aug 24 i `* Re: on allowing "int a" definition everywhere18Thiago Adams
21 Aug 24 i  +* Re: on allowing "int a" definition everywhere4Bart
21 Aug 24 i  i`* Re: on allowing "int a" definition everywhere3Thiago Adams
21 Aug 24 i  i `* Re: on allowing "int a" definition everywhere2Michael S
21 Aug 24 i  i  `- Re: on allowing "int a" definition everywhere1Thiago Adams
22 Aug 24 i  `* Re: on allowing "int a" definition everywhere13Blue-Maned_Hawk
22 Aug 24 i   +* Re: on allowing "int a" definition everywhere5Keith Thompson
22 Aug 24 i   i`* Re: on allowing "int a" definition everywhere4Ben Bacarisse
22 Aug 24 i   i +- Re: on allowing "int a" definition everywhere1Keith Thompson
22 Aug 24 i   i `* Re: on allowing "int a" definition everywhere2Kaz Kylheku
23 Aug 24 i   i  `- Re: on allowing "int a" definition everywhere1Ben Bacarisse
22 Aug 24 i   `* Re: on allowing "int a" definition everywhere7Bart
22 Aug 24 i    +* Re: on allowing "int a" definition everywhere2Thiago Adams
22 Aug 24 i    i`- Re: on allowing "int a" definition everywhere1Blue-Maned_Hawk
23 Aug 24 i    `* Re: on allowing "int a" definition everywhere4fir
23 Aug 24 i     `* Re: on allowing "int a" definition everywhere3Bart
23 Aug 24 i      `* Re: on allowing "int a" definition everywhere2fir
23 Aug 24 i       `- Re: on allowing "int a" definition everywhere1fir
21 Aug 24 `* Re: on allowing "int a" definition everywhere37Lawrence D'Oliveiro
21 Aug 24  +* Re: on allowing "int a" definition everywhere2Ben Bacarisse
21 Aug 24  i`- Re: on allowing "int a" definition everywhere1Ben Bacarisse
25 Aug 24  `* Re: on allowing "int a" definition everywhere34fir
27 Aug 24   `* Re: on allowing "int a" definition everywhere33Lawrence D'Oliveiro
27 Aug 24    +* Re: on allowing "int a" definition everywhere21fir
27 Aug 24    i`* Re: on allowing "int a" definition everywhere20fir
27 Aug 24    i `* Re: on allowing "int a" definition everywhere19fir
27 Aug 24    i  +* Re: on allowing "int a" definition everywhere3fir
27 Aug 24    i  i`* Re: on allowing "int a" definition everywhere2fir
27 Aug 24    i  i `- Re: on allowing "int a" definition everywhere1fir
27 Aug 24    i  `* Re: on allowing "int a" definition everywhere15fir
27 Aug 24    i   +* Re: on allowing "int a" definition everywhere13fir
27 Aug 24    i   i+* Re: on allowing "int a" definition everywhere9Bart
27 Aug 24    i   ii+* Re: on allowing "int a" definition everywhere3fir
27 Aug 24    i   iii`* Re: on allowing "int a" definition everywhere2fir
27 Aug 24    i   iii `- Re: on allowing "int a" definition everywhere1fir
2 Sep 24    i   ii`* Re: on allowing "int a" definition everywhere5Lawrence D'Oliveiro
2 Sep 24    i   ii `* Re: on allowing "int a" definition everywhere4Bart
3 Sep 24    i   ii  `* Re: on allowing "int a" definition everywhere3Lawrence D'Oliveiro
3 Sep 24    i   ii   +- Re: on allowing "int a" definition everywhere1Kaz Kylheku
3 Sep 24    i   ii   `- Re: on allowing "int a" definition everywhere1Michael S
27 Aug 24    i   i`* Re: on allowing "int a" definition everywhere3fir
29 Aug 24    i   i `* Re: on allowing "int a" definition everywhere2fir
29 Aug 24    i   i  `- Re: on allowing "int a" definition everywhere1fir
3 Sep 24    i   `- Re: on allowing "int a" definition everywhere1Lawrence D'Oliveiro
27 Aug 24    `* Re: on allowing "int a" definition everywhere11Blue-Maned_Hawk
28 Aug 24     `* Re: on allowing "int a" definition everywhere10Tim Rentsch
28 Aug 24      `* Re: on allowing "int a" definition everywhere9Keith Thompson
28 Aug 24       +* Re: on allowing "int a" definition everywhere2Ben Bacarisse
28 Aug 24       i`- Re: on allowing "int a" definition everywhere1Tim Rentsch
28 Aug 24       +* Re: on allowing "int a" definition everywhere2Tim Rentsch
28 Aug 24       i`- Re: on allowing "int a" definition everywhere1Keith Thompson
28 Aug 24       `* Re: on allowing "int a" definition everywhere4Tim Rentsch
28 Aug 24        +- Re: on allowing "int a" definition everywhere1David Brown
28 Aug 24        +- Re: on allowing "int a" definition everywhere1James Kuyper
28 Aug 24        `- Re: on allowing "int a" definition everywhere1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal