New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
He's pretty much right. We are talking C here after all. You don't have a lot (or really any) advanced flow control constructs and when you have some function that allocates various resources but can also fail at any given step the cleanest, most efficient and most easy to read option is actually
goto
. The alternatives would pretty much be either duplicating a lot of code or pointless if statements. Duplication might be an option if it's just 2 or maybe 3 resources that need to be cleaned up but beyond that anything butgoto
is basically madness and probably not justified by anything but the goto is evil mantra.For example a part of a minimal http client I wrote some time ago:
That's such a case where something
, for example connecting could fail, reading could fail, the response could not contain a http body, ...
But when you add some other resource, you have to add it everywhere, likely some place is forgot and somehow you then inexplicably run out of file descriptors or memory...
@lukast__
I was mostly thinking of something like
but in general it's pretty much the same idea as your example, just with more resources added to take care of during failure. At just 3 resources (and a somewhat simple/seldom called cleanup logic) it wouldn't be to bad to just duplicate it and directly return from the
if
blocks (it's not like a couple bytes of extra code will make much of a difference in 99% of all cases) but beyond that it quickly becomes quite imperative to just centralize the cleanup logic.Hello I'm the person in question that everyone is spreading My screenshot out I don't associate with 1 of 1 I'm the original person who took down Goodleaf servers then goodleaf decided to post my pictures here to start drama with some other hosting @stefeman has posted proof showing I don't like goodleaf or have 0 clue on who 1 of 1 Hosting is I confronted 1 of 1 and they instantly banned me from there discord because they know they are all in the wrong
Depends. Are you going to pay me $100 for posting a message to me?
Well, it's not like i have much of a choice anymore. Seems someone pushed your only real competition out of business. I'm absolutely puzzled as to who would do such a thing.
my disk is 2.5 inches, my gf says thats ok tho cause it performs better.
I use LTO thanks.
Then i guess what they said about me on youtube is true ☹
Mine is about the thickness of a NVMe, the constant spelling of "run" from my gf makes me confused though.
U.2 or M22?
M.2
Don't worry they got some dirt on me too and while i certainly can't be sure, i don't think it was you putting the guy out of business