---
title: "s = (char*)(long)retval; /* ouch */ — Larry Wall Quote #259 | QuotesBy.net"
description: "s = (char*)(long)retval; /* ouch */ — a quote by Larry Wall."
image: "https://quotesby.net/wp-content/themes/quotesby-editorial/assets/og-default.png"
---

> # s = (char\*)(long)retval; /\* ouch \*/

[Larry Wall](https://quotesby.net/Larry-Wall)\#259

[Safety](https://quotesby.net/Larry-Wall/safety/)

[WhatsApp (opens in a new tab)](https://wa.me/?text=%E2%80%9Cs%20%3D%20%28char%2A%29%28long%29retval%3B%20%2F%2A%20ouch%20%2A%2F%E2%80%9D%20%E2%80%94%20Larry%20Wall%20https%3A%2F%2Fquotesby.net%2FLarry-Wall%2F259%2F)[X (opens in a new tab)](https://twitter.com/intent/tweet?text=%E2%80%9Cs%20%3D%20%28char%2A%29%28long%29retval%3B%20%2F%2A%20ouch%20%2A%2F%E2%80%9D%20%E2%80%94%20Larry%20Wall&url=https%3A%2F%2Fquotesby.net%2FLarry-Wall%2F259%2F)[Facebook (opens in a new tab)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fquotesby.net%2FLarry-Wall%2F259%2F)

## 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 termsCasting 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](https://quotesby.net/Larry-Wall/258/ "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](https://quotesby.net/Larry-Wall/257/ "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](https://quotesby.net/Larry-Wall/256/ "Permalink to quote 256")

## Related quotes

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

[Flip Wilson](https://quotesby.net/Flip-Wilson)[Flip Wilson quote \#1](https://quotesby.net/Flip-Wilson/1/ "Permalink to 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 Child](https://quotesby.net/Lee-Child)[Lee Child quote \#1](https://quotesby.net/Lee-Child/1/ "Permalink to 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 Hillary](https://quotesby.net/Edmund-Hillary)[Edmund Hillary quote \#1](https://quotesby.net/Edmund-Hillary/1/ "Permalink to quote 1")

```json
{
    "@context": "https://schema.org",
    "@type": "Quotation",
    "text": "s = (char*)(long)retval; /* ouch */",
    "url": "https://quotesby.net/Larry-Wall/259/",
    "spokenByCharacter": {
        "@type": "Person",
        "name": "Larry Wall"
    }
}
{
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://quotesby.net/"
        },
        {
            "@type": "ListItem",
            "position": 2,
            "name": "Authors",
            "item": "https://quotesby.net/authors/"
        },
        {
            "@type": "ListItem",
            "position": 3,
            "name": "Larry Wall",
            "item": "https://quotesby.net/Larry-Wall"
        },
        {
            "@type": "ListItem",
            "position": 4,
            "name": "Quote #259",
            "item": "https://quotesby.net/Larry-Wall/259/"
        }
    ]
}
```
