Skip to content
quotesby

About this quote

What does it mean?
A cast from a long to a char pointer is marked with a painful comment, indicating a risky conversion.
In plain terms
Casting a long to a char pointer is unsafe.
What can you take from it?
Be cautious with pointer casts.

Where it applies

  • when interfacing with legacy APIs
  • in systems programming

Putting it to work

  • use proper conversion functions
  • add runtime checks

Questions to consider

  • What alternatives exist to this cast?
  • How can you test for its safety?

Another view

Such casts can cause undefined behavior on many platforms.

More from Larry Wall

  1. /* we have tried to make this normal case as abnormal as possible */

    Permalink to quote #258
  2. Your csh still thinks true is false. Write to your vendor today and tell them that next year Configure ought to 'rm /bin/csh' unless they fix their blasted she…

    Permalink to quote #257
  3. You can't have filenames longer than 14 chars. You can't even think about them!

    Permalink to quote #256

Related quotes

  1. Don't order one for the road, because the road is already laid out.

    Flip WilsonFlip Wilson quote #1
  2. Long experience had taught me that absolute silence is the best way. Say something, and it can be misheard. Misunderstood. Misinterpreted. It can get you convi…

    Lee ChildLee Child quote #1
  3. My solar plexus was tight with fear as I ploughed on. Halfway up I stopped, exhausted. I could look down 10,000 feet between my legs, and I have never felt mor…

    Edmund HillaryEdmund Hillary quote #1