Click here to Skip to main content
15,887,746 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralWeird things you can learn via Youtube Pin
OriginalGriff18-Dec-20 4:49
mveOriginalGriff18-Dec-20 4:49 
GeneralRe: Weird things you can learn via Youtube Pin
W Balboos, GHB18-Dec-20 7:42
W Balboos, GHB18-Dec-20 7:42 
GeneralThought of the Day Pin
OriginalGriff18-Dec-20 4:26
mveOriginalGriff18-Dec-20 4:26 
GeneralRe: Thought of the Day Pin
W Balboos, GHB18-Dec-20 4:34
W Balboos, GHB18-Dec-20 4:34 
GeneralRe: Thought of the Day Pin
PIEBALDconsult18-Dec-20 4:51
mvePIEBALDconsult18-Dec-20 4:51 
AnswerRe: Thought of the Day Pin
megaadam18-Dec-20 5:03
professionalmegaadam18-Dec-20 5:03 
GeneralRe: Thought of the Day Pin
DRHuff18-Dec-20 7:08
DRHuff18-Dec-20 7:08 
Generalthis is one of the weirdest things i've written in a long time Pin
honey the codewitch18-Dec-20 3:48
mvahoney the codewitch18-Dec-20 3:48 
I needed a way to compare an escaped string coming out of a file with a series of unescaped strings passed to a function to see if one of them matches.

The easy way:
Load the string from the file, unescape it and compare each string in turn.
Pro: easy to code and maintain
Con: Requires the entire string to live in memory, requiring a buffer for it first.

The hard way:
Load the string one character at a time from a file, while deescaping inline, keep a list of pointers to the current location for each string you're checking against, compare and advance each of the string pointers in turn. If one doesn't match, disqualify it by setting its pointer to null, and when you're done see if you wound up with an undisqualified string.
Pro: only needs a character at a time in memory, plus scratch for the pointers
Con: Weird to write and maintain.

Because I'm coding on extremely low memory scenarios, i picked the hard way. I hate this code though, but there is an irresponsible part of me that enjoyed writing it. Shucks | :-\
Real programmers use butterflies

GeneralRe: this is one of the weirdest things i've written in a long time Pin
Matthew Dennis18-Dec-20 4:04
sysadminMatthew Dennis18-Dec-20 4:04 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
honey the codewitch18-Dec-20 4:08
mvahoney the codewitch18-Dec-20 4:08 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
Matthew Dennis18-Dec-20 4:18
sysadminMatthew Dennis18-Dec-20 4:18 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
honey the codewitch18-Dec-20 5:47
mvahoney the codewitch18-Dec-20 5:47 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
trønderen18-Dec-20 13:29
trønderen18-Dec-20 13:29 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
honey the codewitch18-Dec-20 14:09
mvahoney the codewitch18-Dec-20 14:09 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
trønderen18-Dec-20 14:34
trønderen18-Dec-20 14:34 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
honey the codewitch18-Dec-20 14:38
mvahoney the codewitch18-Dec-20 14:38 
GeneralRe: this is one of the weirdest things i've written in a long time PinPopular
Rage18-Dec-20 4:21
professionalRage18-Dec-20 4:21 
GeneralRe: this is one of the weirdest things i've written in a long time Pin
PIEBALDconsult18-Dec-20 5:27
mvePIEBALDconsult18-Dec-20 5:27 
GeneralFrom the Daily News - recycling Win7 PCs into Chrome OS... Pin
dandy7218-Dec-20 3:48
dandy7218-Dec-20 3:48 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
honey the codewitch18-Dec-20 3:53
mvahoney the codewitch18-Dec-20 3:53 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
Richard MacCutchan18-Dec-20 5:12
mveRichard MacCutchan18-Dec-20 5:12 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
dandy7218-Dec-20 7:59
dandy7218-Dec-20 7:59 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
Richard MacCutchan18-Dec-20 22:39
mveRichard MacCutchan18-Dec-20 22:39 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
dandy7219-Dec-20 6:35
dandy7219-Dec-20 6:35 
GeneralRe: From the Daily News - recycling Win7 PCs into Chrome OS... Pin
Richard MacCutchan19-Dec-20 11:47
mveRichard MacCutchan19-Dec-20 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.