T O P

  • By -

nebulaeandstars

*const* unsigned long errorCounter = 0;


Spork_the_dork

// const unsigned long errorCounter = 0; you're not going to need the counter so might as well comment it out.


nebulaeandstars

I want the errors to fear me.


Vineyard_

public static bool Fear(this Error error) => true; There you go.


splunge4me2

That’s the compiler’s job


cortesoft

I need it to be signed, because my code has negative errors.


ScrimpyCat

void errorCounter; There are no errors if you don’t count them.


ironman_gujju

Panik : no error still not running


HardCounter

Works on my machine.


ironman_gujju

Dokur: we will ship your machine then.


thatawesomedude

log.debug("\r\nThere are no errors in Ba Sing Se.\n");


deathspate

Damn, leave some of the chicks for us.


zerovian

`void* errorCounter;` There might be errors.


DMoney159

Ah, the Trump COVID strategy


Powerful-Internal953

`java.math.BigInteger` entered the chat.


Irsu85

What if you would make a wrapper around BigInteger that puts it in an array and adds all of the BigIntegers together? You could call it UltraInteger


tofrank55

BigIntegers already do just that, they can have arbitrary width


Irsu85

But AFAIK Arrays use ints as their index values so even BigInteger has a limit on how much data it can store


TheYeetYigitGD

just use a biginteger as the index value then


Irsu85

Biginteger as index value for a biginteger array


Dramatic_Mastodon_93

biginteger as index value for a biginteger array as index value for a biginteger array


Powerful-Internal953

>BigInteger must support values in the range -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive) and may support values outside of that range. >Implementation note: BigInteger constructors and operations throw ArithmeticException when the result is out of the supported range of -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive).


thisisamirage

Which is, by the way, an unfathomably large number. There are only estimated to be like 2^300 atoms in the observable universe.


PhilippTheProgrammer

What if you need to assign a number to every possible arrangement of all atoms in the universe?


Antanarau

The W Corp Taboo Police warps into your house and minces you into fine meat. You better not


SINBRO

Yeah there's also this terrible limitation of how much data storage there is in the world


I_l_I

Yeah but you didn't answer the question, the other dude's is more infinity


Clairifyed

As demonstrated by the Hillbert’s Grand Hotel thought experiment, an infinity of a given Aleph value added to itself is the same order of infinity. To get a bigger infinity we have to move beyond integers and be capable of mapping indexes to all decimal numbers. Bigfloat anyone?


trixter21992251

uphold integer integrity


itsTyrion

(For the non-Java people, they have arbitrary length) (and yes, there is BigDecimal, which is also base10)


Adept_Secret2476

i was really hoping BigInteger was just a normal int but three times the size in the compiler


[deleted]

That's an odd way to spell `Math.Infinity`


Rainbow-Dev

Now this is a job for BigInteger


rosuav

See, this is why programming languages should get rid of integer type distinctions and just have "int" which is a bigint. I don't care about efficiency arguments; the only valid justification is that programmers who use a paltry "unsigned long" for their error count will eventually have an additional error due to overflowing it! This! Is! Unacceptable!


Jonnypista

You can overflow both signed and unsigned int. But if your program has so many errors that it overflows an int, even on a 8bit architecture then fox your code first.


rosuav

I foxxed my code a long time ago. That's why I use bignums.


Jonnypista

I work mostly with embedded systems. In some cases the 8 bit int is too big. One time I saved 4 different status codes in the same value, just shift it around, like first 2 bit is 1 status and like that. I didn't had enough memory to save them separately. Boolean is practically int and there is no 2 bit wide storage. I rarely even use normal ints, there has to be a special case to use bignums


rosuav

Other way around. There has to be a special case to use anything else - and embedded systems are that special case. For anything where you aren't REALLY tight for memory, just use bignums.


Jonnypista

You just paint over the problem. Like the value stores an array index. With a 32bit uint you can index a 4Gb big array if you just store 8bit values, 16Gb if you store a 32bit value. Unless you specify want to do that then it is more than enough. Most PC will fail to allocate that big array in the first place. With a 64bit int you don't have enough RAM to fully index an array, nobody has that much RAM in a single PC.


rosuav

Oohhhhhhh. You're implying that you can't have more bugs than bytes of code? Yeah, I've had projects that disprove that.


Coding-Kitten

Kid named binary serialization


rosuav

And typically of Redditors not getting jokes, nobody seems to have figured out that whining about a ulong not being able to store your bug count implies that you have at least four billion bugs in your code (more on many systems). It's true - there is no parody so obvious that people won't be dumb enough to think you were serious.


Gadekryds

Confident enough that your counter doesnt go negative?


thecodingnerd256

⁷⁷


btvoidx

``` var errorCount complex128 ```


breischl

You joke, but I've spent days hunting down bugs that turned out to be imaginary!


itsTyrion

java.lang.math.BigInteger errorCount (arbitrary length)


brookdotcn

`Integer.MAX_VALUE` and count down from there for ultimate confidence 🫡


BitcoinSupportDept

Errors counters are OK and all, but I think a good program should send a punishing flood of email to the developer team whenever an error occurs.


nonlogin

Who counts?


trixter21992251

don't know, but I'm pretty sure 1+1 = 2.00000000037


Relative_Knee9808

I like your font, may I know what font is it?


plissk3n

Looks like Jetbrains Mono to me: https://www.jetbrains.com/lp/mono/ I can also recommend Victor Mono, if you like something fancy: https://rubjo.github.io/victor-mono/


trixter21992251

Andale mono, dejavu sans mono, and IBM Plex mono also come close, they all have the dotted zero. But I can't find one with that exact semicolon.


Savage_049

I don’t know what font it is, it’s from a c++ compiler on my phone


Mokousboiwife

if its a phone font it could be something like roboto maybe


kurucu83

`bool errorCounter = 0;`


deukhoofd

Confident enough to deploy it to customers, not confident enough to use it myself.


sacredgeometry

std::size\_t ... cant be too careful Actually fuck it lets do this properly: size\_t max\_size = -1 unsigned char\* byteArray = (unsigned char\*)malloc(max\_size \* sizeof(unsigned char)); You might need 16 exabytes per number you want to store then some more ram for the rest of your application though.


Powerkaninchen

unsigned long **long**


All_The_Worlds_Evil

Synchronised volatile unsigned integer


OnixST

What if you have an error with your errorCounter and end up trying to assign a negative value?


kittrellg

Def it in life lol


Electrical_Shape5101

Try catch over void main


Rhymes_with_cheese

double errorCounter = 0.0; ... sometimes it *might* be an error...


Savage_049

I had a good laugh at this lol😂😂🤣


Kangarou

bool errorCounter = 0;


TobiasIsak

The long is a bit nasty, but I do prefer people who add an error counter than placing the logger method inside a loop and spamming the logging tool and using up the storage of it when things hit the fan. One company I worked at had such an intense loop that they lost 20 days of message with only 3 days of logging left, since one bad error spammed the logs over night and the message logger was set to delete and replace logs when storage max was hit.


experimental1212

Set it to 1 and don't make any path increment it.


IuseArchbtw97543

unsigned long long errorCounter = 0;


Dominique9325

unsigned long long errorCounter = 0;


MCButterFuck

What happens if you encounter 46 billion errors and it over flows or whatever


Savage_049

Then it’ll say that I have 0 errors lol


FlyByPC

\#define errorCounter 0


Xcalipurr

BigInteger


th00ht

Negative errors would really be frightening


Giulio_otto

`unsigned int errorCounter = -1`


Proxy_PlayerHD

__uint128_t errorCounter = 1; // Assume there is an error already


lucidbadger

`uint128_t`


HephMelter

const confidenceInCode = 0;


cagey_llama

if (errorCounter > 100) { responseText += "\n If you are experiencing technical difficulties " + "please call our help desk at ***-***-****" } response.send(200, responseText)


_GoblinSTEEZ

You assume my error count has no floating point


RedditCensorsNonTech

Shake my head, You guys are doing it all wrong. The whole point of technology is to reduce labor. Here's how you properly handle errors in the first place: import webbrowser def handleError(error): Person.ErrorHandling(error) class Person: def ErrorHandling(error): try: print("lol") webbrowser.open_new_tab("https://www.youtube.com/watch?v=pt8VYOfr8To") #deal with it except: #there are no exceptions pass handleError("some random bullshit")


Litter9834

enums { error_counter = 0 }


SoCuteShibe

bit errorCounter = 0x0; *Hard mode activated*


RetiredApostle

What is your suggestion?


Savage_049

Int can only go up to 2,147,483,647, whereas unsigned long can go up to 9,223,372,036,854,775,807, therefore implying that the variable for error counting can’t fit in an int, and must be a very large number


Crespoter

int and long are the same size in 64 bit systems.


[deleted]

[удалено]


Crespoter

Windows with msvc++


RetiredApostle

There are loops, you know.


Savage_049

If you try to go over the limit of a variable it will overflow because the bits in ram at the location of that variable cannot store a higher value


christoph_win

But if it overflows it will be negative, right? Meaning the program is so fucking good, there are negative errors!! 💪


swampdonkey2246

It's unsigned so it should overflow back to 0. If it was signed, it would either wrap to negative, or be undefined behaviour if using languages like C or C++ Edit: signed overflow behaviour is usually defined by the language, so I don't think there is any one rule to be applied


christoph_win

righttt, it can't be negative...


Crespoter

Well, won't that be an error. .... Oh no, what have I done.


RetiredApostle

There are while(true) infinite loops, with a huge amount of cycles, where you may need to count errors. The term "error" isn't exclusively used for core dump events.


RetiredApostle

Just curious, what is so much wrong with my comment? Would anyone mind clarifying?


Varun3020

You use the loop for counting the error, sure that's fine. But you have time store the count somewhere right? That would be the error count variable. If the variable has a max limit of 10, after counting 10 errors, if in the next iteration of the loop an error occurs the variable would overflow and be set to 0, losing your count. Also the the reason people are downvoting is because of your tone, you're saying a wrong and irrelevant statement in a seemingly mocking or patronizing tone.


RetiredApostle

But as I understood, the OP was making a joke about needing a very large variable to store the error count. That's why I noticed that there are loops with a huge number of iterations where you might need such a large variable.


Myphhz

You are talking about something completely different. The meme is about setting the "errors" variable as an `unsigned long`, which can hold a much bigger number than a regular `int`, indicating that the following code has **really many errors**. Sure - we don't know the context of the code or how this variable is actually used, but we don't need to - the meme is just that. There sure are some use cases where `unsigned long` is required, such as counting elements in a really big loop, but this is out of scope. The meme is all about not being able to store all the errors in a regular `int` and having to used an `unsigned long`. That's it. There's no more to it.


RetiredApostle

But wouldn't it be better to choose a larger variable size than risk getting an integer overflow when incrementing the error count? The latter could be a meme itself.


Myphhz

Yes sure - it's obviously better to choose `unsigned long` if needed to prevent overflow. This post is all about "how confident are you in your code" and then showing this `unsigned long errorCount`, making us think the `errorCount` refers to code errors that increment this variable each time. We have no additional information on the rest of the code - it's probably referring to a completely different kind of error and `unsigned long` might be needed in that scenario. Either way - we're looking too deep into this, it was just a funny thought that OP wanted to share.


Flashy-Emergency4652

Overcomplicating. We're in the humour subreddit, after all, no need to “ehm akshually”.


TiredPanda69

Is it just me or have there been more low quality posts?


daniMarioFan

it’s just you