On 80 columns should (not) be enough for everyone
spir
denis.spir at gmail.com
Mon Jan 31 12:59:07 PST 2011
On 01/30/2011 10:29 PM, Nick Sabalausky wrote:
> void main()
> {
> void foo()
> {
> while(true)
> if(done)
> {
> }
> }
> }
>
> I'm a big fan of "stacking" flow-control statements like that whenever the
> outer statements don't have anything else in their body.
>
> Like this (stupid example):
>
> // Draw funny design (and yes, this could be optimized better)
> if(shouldRefresh)
> foreach(int x; 0..width)
> foreach(int y; 0..height)
> if(x ^ y< width*height / 2)
> buffer[x + y*width] = palette[(x+y) % $];
>
> Instead of something more like:
>
> // Draw funny design (and yes, this could be optimized better)
> if(shouldRefresh)
> {
> foreach(int x; 0..width)
> {
> foreach(int y; 0..height)
> {
> if(x ^ y< width*height / 2)
> buffer[x + y*width] = palette[(x+y) % $];
> }
> }
> }
>
Nice idea :-) Really makes sense, imo.
Denis
--
_________________
vita es estrany
spir.wikidot.com
More information about the Digitalmars-d
mailing list