Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How is perl able to handle the null byte?

by Joost (Canon)
on Jun 15, 2006 at 21:07 UTC ( [id://555627]=note: print w/replies, xml ) Need Help??


in reply to Re: How is perl able to handle the null byte?
in thread How is perl able to handle the null byte?

Quite true. Strictly speaking, C doesn't have a string type: what's conventionally used instead is a pointer to a (single) character which is equivalent to an array of characters because of the way C arrays work 1]. The "string type" in C is literally "char *".

1] C arrays do not really have a length either, defining an array with a certain length only reserves that amount of memory, the length isn't stored anywhere.

  • Comment on Re^2: How is perl able to handle the null byte?

Replies are listed 'Best First'.
Re^3: How is perl able to handle the null byte?
by ChemBoy (Priest) on Jun 15, 2006 at 21:50 UTC

    Reminding me of a classic exchange from a CS class I took once (OK, the CS class I took...):

    Student (slightly paraphrased): you mentioned that the address after the last member of the array is guaranteed to be a legal address, though you don't technically have it allocated to you. Don't a lot of people use that fact to just pretend their array indexes are 1-based instead of 0-based?

    Professor: Lot's of people J-walk, too! Some of them get killed!

    Ah, those were the days... ;-)



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://555627]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-19 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found