Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail From: fir Newsgroups: comp.lang.c Subject: Re: on allowing "int a" definition everywhere Date: Tue, 27 Aug 2024 23:42:19 +0200 Organization: i2pn2 (i2pn.org) Message-ID: References: <7ea05965a67fa09d4ebd0b6ec53109dcb0b12f76@i2pn2.org> <3775b5abd14443f89852e05177a44bd72585cbdd@i2pn2.org> <4c7a695b1b755393162a1ae36ea6306760ffe949@i2pn2.org> <41520456e45d778ea26805f6f711a05757365bc3@i2pn2.org> <533d6e07522d001292cbf93ddb5c0b0a6985c13f@i2pn2.org> <7d84a6c77a2ee958c0f2a08e4fac248e5ad7aea8@i2pn2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 27 Aug 2024 21:42:19 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="4147570"; mail-complaints-to="usenet@i2pn2.org"; posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0"; User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24 In-Reply-To: <7d84a6c77a2ee958c0f2a08e4fac248e5ad7aea8@i2pn2.org> X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 4557 Lines: 91 fir wrote: > 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>>>> 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>>>> `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>> 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 > some probably most suitable to use ¡¦¨«¬¯°±²³´¶·¸¹º»¿¼½¾ª§ˆˇˉ˘˙˙˚˚˛˜˝;΄΅΄΅·ψ–――‗‘’‚“”„†‡•…‰‹›‼‾⁄ⁿ←↑→↓↔↕↨∆∂∏∑−∙√∞∟∩∫≈≠≡≤≥⌂⌐⌠⌡─░▒▓■▬▲►▼◄◊○◘◙☺☻☼♀♂♠♣♥♦♪♫