There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

darcy ,
@darcy@sh.itjust.works avatar

should have used Rust instead. that way you never talk to a friend in the first place

Gentoo1337 ,
@Gentoo1337@sh.itjust.works avatar

girlfriend_list->start

Segmentation fault (core dumped)

xmunk ,

Pointer references protected (Canadian) memory.

Aurenkin ,

What was your first girlfriend like?

error: IndexOutOfBoundsException

QuazarOmega ,

Ah shoot, she’s actually their zeroth girlfriend

agent_flounder ,
@agent_flounder@lemmy.world avatar

I hate when I am written in Pascal

dan ,
@dan@upvote.au avatar

The best programming languages let you pick if arrays are base 0 or 1. Shout out to Option Base 1.

xmunk ,

Shout out to PHP which just don’t give a fuck $arr[‘apple’] = 5

dan ,
@dan@upvote.au avatar

PHP causes so many issues because of the fact that it uses the same syntax for both arrays and dictionaries/maps. [] (or array() in older PHP versions) always JSON encodes to [] because there’s no way to tell if it’s supposed to represent an empty array or an empty dictionary.

xmunk ,

Eh. It works just fine. I agree JSON encoding is weird but if you use it the recommended way (just use a StdClass object and throw on the fields you need) it works fine. Someone added half assed support for weird PHP arrays that usually works and is generally good enough.

dan ,
@dan@upvote.au avatar

stdClass is for objects. I’m talking about maps. I guess you could use stdClass for maps too, but that feels weird.

xmunk ,

If you read the docs for json_decode, the default behavior is to operate with stdClass - I too prefer working with associative arrays because of their power but… that kind of just reinforces how useful they are. PHP can give you the full Java class system if you want… it’s just a pain and useless in most circumstances so we all just toss around associative arrays.

QuazarOmega ,
palordrolap ,

Perl had $[ (yes, just those two characters) to allow setting of the first array index, but it's a fatal error to put anything but 0 into it now.

Of course, since Perl arrays can be negative subscripted from the last element, you can stand on your head and index the array negatively from the wrong end. -1, -2, -3 etc. Use unshift to put things on the beginning (logical "end") of what you're doing rather than the usual push. Presto, a 1-based array (up to sign, anyway).

You may wish to file this under "stupid, but it works".

People with more time / more need for something that looks professional, would probably be better off writing something that uses tie instead. (Or, yes, yes, a different language entirely, hush now.)

TurtleTourParty ,

Thanks I hate it.

But still better than mathlab not allowing 0 indexed arrays.

P1r4nha ,

You gotta allocate your GFs statically or this just keeps happening.

30p87 ,

*‘^You gotta allocate you GF$’

n3cr0 ,

The struct and its CRUD functions seem to be all implemented. Problem is: The Create method is never be called.

P1r4nha ,

Might be a problem with the factory then.

Tolookah ,

I tried to declare my GF global, but she became an astronaut, and I get linking errors

xmunk ,

Mate, your GF is definitely global. I was able to access her just fine… read AND write.

agent_flounder ,
@agent_flounder@lemmy.world avatar

Plus you won’t worry that you forget to free her

xmunk ,

As low as my opinion on some exes may be, I still don’t believe it’s appropriate to mark them as candidates for garbage collection.

datelmd5sum ,

I’d add an imaginary boolean flag to the GF class and always have an initial GF where imaginary == True.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines