Alice’s Adventures in C++land

Once upon a time, there was a lit­tle girl named Alice. She was to observers a quiet and shy girl, and chief among her pas­sions was com­puter programming.

One night, when Alice’s pretty face was illu­mi­nated only by the light of her com­puter ter­mi­nal and her lat­est caf­feine hit was just begin­ning to kick in, she noticed a most curi­ous thing. Stand­ing behind her, peer­ing over her shoul­der, was a five foot tall bipedal white rabbit.

“How queer,” Alice thought. “I really must cut down on the Moun­tain Dew.”

She turned back to her monitor.

“Good evening,” said the rabbit.

Alice freaked out and hit it with her keyboard.


Two min­utes later, when they had both assured them­selves that the other was real and had apol­o­gised suf­fi­ciently, the rab­bit coughed and continued.

“Hurry, Alice,” he said, “come with me! Leave behind the sim­plic­ity of Python, the exten­si­bil­ity of Ruby! Even the porta­bil­ity of Java and the exces­sive punc­tu­a­tion of Lisp you no longer need! Come away with me, Alice, and see how deep the rab­bit hole of devel­op­ment goes!”

“But, kind Mis­ter Rab­bit, I do so love these fan­tas­tic languages!”

“Come now, Alice. Take the red pill,” the rab­bit said, brush­ing dan­ger­ously close to copy­right infringement.

“Now you’re offer­ing me pills? This doesn’t lend you a lot of respectabil­ity here, you know.”

“Oh, er…” The white rab­bit looked guilty. “They’re only jelly beans.”

“Sold!” exclaimed Alice, tak­ing the cinnamon-flavoured bean and swal­low­ing it whole. Quite miss­ing the point of a sweet you might think, but nev­er­the­less it did its job well enough.

A few moments later, Alice felt her­self falling, down­wards and fur­ther down­wards, through a hole sided with dirt and explicit mem­ory man­age­ment and half-arsed object orientation.


When she awoke, she found her­self in a room floored entirely with boxes. Even as Alice watched, some were filled and some were emp­tied, and still more changed colour.

“Ah,” thought Alice, who was gen­er­ally accused of being too smart for her own good, “this must be some form of phys­i­cal rep­re­sen­ta­tion of the computer’s memory.”

She looked around to see if she could see the white rab­bit, but he had disappeared.

Lost and far from home, Alice’s spir­its sud­denly sank. She sat and watched the mem­ory floor deject­edly for a while. Even­tu­ally she began to count the buffer over­flows to pass the time.

“for (int numOverflows=0; numOverflows>=0; numOver­flows++),” she thought, “I’ll stay here.”

Mer­ci­fully she was in C++land, so five min­utes later she was on the move again. She walked onwards until there were no more boxes and only a flat plane to move on.

At last she saw a door ahead of her, and she ran towards it, but thank­fully she had the good sense to look behind her! More and more boxes were appear­ing, and they were catch­ing up!

“Oh noes,” Alice exclaimed. “A mem­ory leak!”

With that, she began to sprint as best she could towards the door, while ever pass­ing sec­ond brought the errant mem­ory rush­ing ever closer to catch­ing up with her and over­writ­ing her!

With only a few steps to go, and the mem­ory grasp­ing at her heels, Alice leapt and dived through the door — thud­ding into some­thing soft beyond. The door slammed shut, seem­ingly on its own, the moment she was through.


When Alice had quite regained her senses and taken stock of the sit­u­a­tion, she helped her soft pil­low to his feet.

“Oh, Mis­ter Rab­bit,” she said. “I’ve seen such hor­ri­ble things, and I do so want to go home.”

“I’m dread­fully sorry, Alice, but I’m afraid I just can’t return you to your home.”

“What?!”

“I can only return a pointer to you! Wahahahaha!”

“No!” cried Alice. “I don’t want to stay-”

And then the func­tion terminated.


“Ah,” said Alice, alone in the dark­ness. “No garbage col­lec­tor. Handy.”


Next week in C++land: “lookingGlass.goThrough(*pAlice);”!

Leave a Reply

Connect with:

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">