Jump to content

  • Log In with Google      Sign In   
  • Create Account

l0calh05t

Member Since 16 Dec 2000
Offline Last Active Today, 01:26 AM

Posts I've Made

In Topic: What a web I Weave !

18 October 2014 - 05:58 AM

OK tell me which of these two is easier to read:

 

both are ok, but not great. the explicitly indented one has a 3-space indent which is slightly too small for my taste. but neither is really a problem. even on a half-screen window the lines aren't cut even in the 8-space case.


In Topic: What a web I Weave !

17 October 2014 - 04:31 AM

The only editor I know that still does that is notepad. And the code is still readable with larger indentations. Especially on modern wide screens. And on the web there is the CSS3 tab-size property. And plenty of JS syntax highlighters also support that.

 

Besides, space indentation on non-programmer editors is even worse as it is incredibly annoying to edit.


In Topic: What a web I Weave !

17 October 2014 - 04:11 AM

Spaces for indentation are utter bullshit. Tabs are smaller, more flexible (can be adjusted as preferred) and have no disadvantages, except in crappy forum software that doesn't properly support tabs. Using tabs for alignment beyond the first non-whitespace character will break things though. Though aligning variables and other OCD bullshit is a waste of time anyway.

 

Tabs for indentation.

Single spaces for separation.

Anything else is just plain dumb.


In Topic: Funniest line of code ever ?

08 October 2014 - 06:47 AM

 

Actually pi/180? Hmm

 

Arrrrww!! blink.png 180/pi

 

The irony. laugh.png

 

Closer, but still wrong ;)


In Topic: Funniest line of code ever ?

03 October 2014 - 01:52 AM

 

That sounds like a deficiency of the language, not of the programmer. I'd rather take "Animation* forward, backward, left, right;" over "Animation* anims[4];" any day.

Which is why practically all modern languages support dictionaries (which are basically arrays but instead of using integer indices they use string indices).

 

Of course even in something like C you can achieve something similar by using enumerations (if you still want to hardcode it), e.g. ANIM_RUN_UP, ANIM_RUN_LEFT, etc. My biggest annoyance about C (and C++) though is that in structs you can use integers with specific bit sizes (e.g. if you have lots of boolean values why not make them 1 bit each?), but said integers can't be turned into arrays >=| (which would make sense to e.g. make bitfields and such, would make for a much nicer syntax than using & and | with a single variable)

 

Yeah, although dictionaries are rarely efficient. but in principle you could use them in C++ as well. Enums are a nice in-between way.

About the bitfields: it just can't work with the language semantics defined in C as it would violate either that the array elements are contiguous or that they have individual adresses. There is always std::bitset or std::vector<bool> which wraps all the & and | for you (the second one sucks though as it pretends to be a container but isn't)


PARTNERS