Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Soricidus
Oct 21, 2010
freedom-hating statist shill
no

Adbot
ADBOT LOVES YOU

jony neuemonic
Nov 13, 2009

Bloody posted:

c has string functions?

c has strings?

quiggy
Aug 7, 2010

[in Russian] Oof.


jony neuemonic posted:

c has strings?

what is a string but an array of characters? and what is a cat but a furry bag full of meat and knives?

skimothy milkerson
Nov 19, 2006

Terrible programmers: what is a string but an array of characters?

Notorious b.s.d.
Jan 25, 2003

by Reene

Luigi Thirty posted:

I too am ending up basically implementing all of C's string functions but in 68000 asm

the c stdlib string functions are so bad you should do this anyway

no shame

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
420 time to strtok it up

mystes
May 31, 2006

Skim Milk posted:

Haskell prelude: what is a string but a list of characters?

Bloody
Mar 3, 2013

what is a string but a contiguous block of memory that runs until a zero

quiggy
Aug 7, 2010

[in Russian] Oof.


What is a string? A miserable little array of characters. But enough talk... Have at you!

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

Skim Milk posted:

Terrible programmers: what is a string but an array of characters?

hobbesmaster
Jan 28, 2008

if you think about it, everything is an array of chars! :2bong:

Bloody
Mar 3, 2013

actually everything is a miserable pile of bits

hobbesmaster
Jan 28, 2008

you mean vector<bool>

quiggy
Aug 7, 2010

[in Russian] Oof.


hobbesmaster posted:

you mean vector<bool>

:gonk:

VikingofRock
Aug 24, 2008




quiggy posted:

Terrible Programmers: What is a string? A miserable little array of characters

mekkanare
Sep 12, 2008
We have detected you are using ad blocking software.

Please add us to your whitelist to view this content.
It's all just bits in the wind.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Notorious b.s.d. posted:

the c stdlib string functions are so bad you should do this anyway

no shame

well okay i've only really had to write memset, memcmp, strlen, and strcmp so far

Notorious b.s.d.
Jan 25, 2003

by Reene

now do strtok, but make it not suck

Bloody
Mar 3, 2013

dont do c style strings

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bloody posted:

dont do c style strings

that's how they come in from the simulator :(

Bloody
Mar 3, 2013

i believe in your ability to modify the simulator

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bloody posted:

i believe in your ability to modify the simulator

well the source is available but it requires Borland C++ 6 to build which I didn't even know existed

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Luigi Thirty posted:

well the source is available but it requires Borland C++ 6 to build which I didn't even know existed

lol. havent heard borlands name since i did turbo pascal in high school.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

what are the alternatives to C-strings that are applicable here anyway? Pascal strings?

Bloody
Mar 3, 2013

hell yes

Bloody
Mar 3, 2013

in a twist of irony, c-strings are some p-lang bullshit with p-strings are the one true string

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
string is only a label you choose to give to a bunch of bytes; forget about any deeper meaning and you shall know true peace

gonadic io
Feb 16, 2011

>>=

YeOldeButchere posted:

string is only a label you choose to give to a bunch of bytes; forget about any deeper meaning and you shall know true peace

let me just index into this bunch of bytes, no problem

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
OH NO YOU FOOL YOU HAVE GONE PAST THE END OF THE ALLOWABLE RANGE OF BYTES! NOW YOU ARE DOOMED TO UNDEFINED BEHAVIOR UNTIL THE END OF TIMES!

FOREVER!

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
actually you're allowed to go one past the allowable range of bytes, you're just not allowed to look down at what you're standing on

the wile e coyote rule of pointers

ErIog
Jul 11, 2001

:nsacloud:

Luigi Thirty posted:

what are the alternatives to C-strings that are applicable here anyway? Pascal strings?

Strings are just a way to smash text into a data structure. It sounds like a trivial thing, but it stops being trivial the second you start needing to represent more than a few hundred characters.

Things like Boost or ICU are often used instead of C/C++ strings.

Friends don't let friends reinvent strings in projects that matter. Use a library. Strings are harder than you know, and you WILL gently caress it up and introduce tons of sec fuckups and then when it comes time to do i18n later you're gonna wanna say :fuckoff:

ErIog fucked around with this message at 07:53 on Aug 24, 2016

hobbesmaster
Jan 28, 2008

ErIog posted:

Strings are just a way to smash text into a data structure. It sounds like a trivial thing, but it stops being trivial the second you start needing to represent more than a few hundred characters.

Things like Boost or ICU are often used instead of C/C++ strings.

Friends don't let friends reinvent strings in projects that matter. Use a library. Strings are harder than you know, and you WILL gently caress it up and introduce tons of sec fuckups and then when it comes time to do i18n later you're gonna wanna say :fuckoff:

normally I would agree with all this but luigi30 is creating basic libraries for ancient architectures for fun

in which case: do some stuff with the cstring functions since you're doing it for the hell of it. then look at what you'd need to do for a proper Unicode library like Qt's qstring and run screaming back to your dos renderer

ErIog
Jul 11, 2001

:nsacloud:
I'm familiar with what Luigi Thirty is doing. That's why I said "in projects that matter."

I'm pretty sure he doesn't care much about i18n for his toy project, but he could probably use ICU to get Unicode support.

It would be a good exercise, and the Japanese support would make it good for a e s t h e t i c.

ErIog fucked around with this message at 08:04 on Aug 24, 2016

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

Jabor posted:

actually you're allowed to go one past the allowable range of bytes, you're just not allowed to look down at what you're standing on

the wile e coyote rule of pointers

this extends to iterators in general, too

it reminds me of that time i decided i'd try implementing some stl containers on my own and tried to stick to "strict" c++ as much as possible. one of the issues i had was with the value of the end() iterator for sets/maps. the iterator was just a pointer to the correct node in the underlying tree, so my first thought was making it null for the end() iterator. but then decrementing that iterator wouldn't be possible unless it also kept a pointer to the root of the tree as well. every option i considered had its own drawbacks, so eventually i looked at the actual implementation on my machine and it turns out it just has a base_node class and a derived actual_node<T> class, with a node of type base_node to mark the end of the tree. it just static_casts everything to actual_node<T> when you try to dereference an iterator, which is exactly the sort of stuff i was trying to avoid in the first place

the lesson here is that even the stl doesn't care much about casting things all over and neither should you

Soricidus
Oct 21, 2010
freedom-hating statist shill
my god it's full of chars

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Soricidus posted:

Terrible programmers: my god it's full of chars

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Soricidus posted:

Terrible programmers: my god it's full of charsÒopv¨Æ®}ùÇVÆs£·O"\Oz¯¿kêHÉ~êçW$Rß»mÖÞ¯b

Bloody
Mar 3, 2013

redleader
Aug 18, 2005

Engage according to operational parameters

HoboMan posted:

so the api i am now lead dev on is secretly just a wrapper for a another api that no one even knew about

by a wrapper i mean the endpoints in it literally just call endpoints for a different api

e: i'm really at a loss for what to do about this

oh yeah, we do this. right down to the api making request to other api running on the same machine. the reason that we did such an awful, awful thing was due to time constraints and legacy code

Adbot
ADBOT LOVES YOU

redleader
Aug 18, 2005

Engage according to operational parameters
i felt bad for the guy who had to go and write integration tests for that

i heard that he needed to use an awful lot of Thread.Sleeps

  • Locked thread