Author Topic: [OT] Interesting programming articles  (Read 6160 times)

Offline whitelynx

  • GNE Founder
  • Head Code Monkey
  • Commodore
  • *****
  • Posts: 304
  • Karma: +4/-0
  • Internet Idiocy Pundit
    • View Profile
[OT] Interesting programming articles
« on: October 21, 2006, 12:50:32 pm »
A very interesting thing I just came across is something called "the Named Parameter Idiom". Basically, it allows C++ to have something similar to Python's keyword arguments. (things like func(foo="boo!", bar=3) in Python) The article can be found at http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18.
"Without music, life is a mistake, a trial, an exile."
 - Nietzsche

Offline whitelynx

  • GNE Founder
  • Head Code Monkey
  • Commodore
  • *****
  • Posts: 304
  • Karma: +4/-0
  • Internet Idiocy Pundit
    • View Profile
Re: [OT] Interesting programming articles
« Reply #1 on: October 21, 2006, 04:07:59 pm »
Another very useful site I just came across is one which lists all the predefined macros in almost any compiler you can think of. This is very useful for telling what architecture, compiler, or environment you're using. It can be found at http://predef.sourceforge.net/.
"Without music, life is a mistake, a trial, an exile."
 - Nietzsche

Offline whitelynx

  • GNE Founder
  • Head Code Monkey
  • Commodore
  • *****
  • Posts: 304
  • Karma: +4/-0
  • Internet Idiocy Pundit
    • View Profile
Re: [OT] Interesting programming articles
« Reply #2 on: October 22, 2006, 04:40:17 am »
Just browsing through the Boost docs, and I came across a very interesting type, boost::any. It is basically a variant type that's a hell of a lot safer than a union. (and more flexible i believe) On the examples page, they also have an example of a key/value pair class with boost::any as the 'value' type, allowing you to set arbitrarily-typed values.
"Without music, life is a mistake, a trial, an exile."
 - Nietzsche