A r t i c l e s
Navigation

Note: This Wiki is
outdated, personal views
may have changed.
L505 A.I. bot is dead
long live THX 1138

M a i n P a g e

D i r e c t o r y

Why Ansi C Underscore Does Not Work


Do some simple math calculations:

How many options do you have left, if you decide to use dominant underscores and all lowercase on day one? What other symbols can you possibly use to separate your function suffixes from your function words when you really need something like this?

  TheProgramFunction_special
  TheProgramFunction_safe
  TheProgramFunction_unsafe
  TheProgramFunction_unfiltered
  unsecure_TheProgramFunction
  unfiltered_TheProgramFunction
Clever use of the underscore allows our suffixes or prefixes above to jump out at us when we really need them to. It looks different and alerts the programmer that some special function is being used.

In case insensitive languages, the special functions could be made even clearer:

  UNFILTERED_TheProgramFunction
In case sensitive languages, all lowercase is used in order to avoid bugs with mixing case.. but you can't make things jump out when you need to if you strictly follow the bondage and discipline 'always use lower case with underscores'. It is all lowercase consistent spaghetti on the screen when we use lower case underscore standards.. and we don't necessarily WANT it to be a bunch of consistent looking prose.

Below, these suffixes no longer jump out when we use all lowercase underscore. They are hidden in with the consistent all lower case.. and nothing jumps out.

  the_program_function_safe
  the_program_function_unsafe
  the_program_function_unfiltered
  i_cant_tell_apart_my_important_suffix_from_my_function
It is all blended in. Underscores can be used to make TheseFunctions_jumpout but when we use these_functions_they_dont_jump_out.

I think as projects get larger, we should have options to make certain functions jump out, and saving the underscore for these situations is bright.

If you choose to use all underscore/lowercase.. then it limits you in the future. You cannot use the underscores for rare cases when you really need to make code jump out.

When documenting functions, the functions with all lowercase underscores also do not jump out in the documentation since they look like prose. Whereas MixedCaseFunctions jump out in the documentation since they don't look_like prose.

The argument from Cee programmers is that underscores make your code LOOK like prose and this is a good thing. Why is this a good thing necessarily? It can be a disadvantage. It means functions blend in with source comments, documentation, or english paragraphs about programming. Actually we would want the functions to jump out and not be part of the prose in many cases, right?.

For example:

// this is a comment
// this one comment
// this_one_function // looks like prose, why is this good?
// this one comment here on this line
// this is a comment
// this one comment
// ThisOneFunction  // jumps out, capitalization doesn't look like prose
// this one comment here on this line
// this is a comment
// this one comment here on this line
// this_one_function_special  // looks like prose (especially with small fonts)
// this one comment here on this line
// this is a comment
// this one comment here on this line
// ThisOneFunction_SPECIAL // jumps out, does not look like prose
// this one comment here on this line

Nothing is a holy grail.

Using all_lower_case and underscores is a form of bondage and discipline. I thought C wasn't suppose to be bondage and discipline oriented?

See also:

Underscores-Discussion

Rob-Pike-And-Paul-Krzyzanowski

About
Note: This Wiki is outdated, personal views may have changed.

This wiki contains info on life, health, humans, nature, programming, database, fads, paradigms, poems, principles, theories.

Articles may contain statements which some may find helpful and encouraging, or even discouraging.

Beware, I believe in the Grand Justice system.
_ _ _