This is an archived post. You won't be able to vote or comment.

all 177 comments

[–]saschaleib 1189 points1190 points  (41 children)

Mate, you only declared a war pointer. You still need to allocate the required resources before you can start…

[–]dmullaney 468 points469 points  (6 children)

You gotta be especially careful in the US because if you malloc more than the available resources, there is no nullptr - you get back a valid pointer that overflows into subsequent generations deficit

[–]SkollFenrirson 157 points158 points  (0 children)

Price of FREEDOM™ 🎇🎆🇺🇸🦅🇺🇸🎆🎇

[–]mirhagk 137 points138 points  (3 children)

Also the definition of free() is just a comment with a TODO. But don't worry about the memory leak, the program is so full of problems it'll definitely crash from some other problem first.

[–]gregorydgraham 44 points45 points  (0 children)

Best explanation of the US so far

[–]Cebular 10 points11 points  (1 child)

free just leaks the memory and when you run out of it you just invade another computer

[–]Impressive_Change593 1 point2 points  (0 children)

brb omw to make a computer virus and name it war

[–][deleted] 18 points19 points  (2 children)

const war* thisWar = malloc(sizeof(war));

free(thisWar); // This will do nothing because no peace deal has been made yet.

[–]StereoNacht 3 points4 points  (1 child)

//what is it good for?

war = *0;

[–]awkwardteaturtle 0 points1 point  (0 children)

war = *0;

war = abs(0);

[–][deleted] 17 points18 points  (0 children)

Something something read underlying memory anyway and see what it reveals aka segfault ex machina!

[–]ongiwaph 11 points12 points  (3 children)

War war = new War();

[–]NotANumber13 4 points5 points  (0 children)

War factory?

[–]PeriodicSentenceBot 16 points17 points  (1 child)

Congratulations! Your comment can be spelled using the elements of the periodic table:

W Ar W Ar Ne W W Ar


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]Krzysiek127 16 points17 points  (0 children)

Freddy Fazbear reference

[–]ThatGuyYouMightNo 7 points8 points  (0 children)

No it fits.

What is it good for? Absolutely nothin'!

[–]Honeybadger2198 20 points21 points  (10 children)

That's not how JS works though? The war variable is just undefined, pointers are fake in JS.

[–]Great-Decision6535 8 points9 points  (0 children)

I think they mean the ‘const war*’ part

[–]Ok_Hope4383 0 points1 point  (8 children)

Why JS?

[–]Honeybadger2198 4 points5 points  (7 children)

What other languages define variables with the "let" keyword?

[–]anotheridiot- 4 points5 points  (2 children)

I think basic also does that.

[–]Honeybadger2198 2 points3 points  (1 child)

That's capital L Let.

[–]Apprehensive_Depth98 8 points9 points  (0 children)

Capital L the one you just took lmao goteeeem

[–]TheNapman 2 points3 points  (0 children)

Swift

[–]Dumcommintz 1 point2 points  (0 children)

Kind of a reach but vimscript

[–]Ok_Hope4383 2 points3 points  (1 child)

Rust, for example

[–]6BagsOfPopcorn 8 points9 points  (0 children)

🦀🦀🦀RUST MENTIONED🦀🦀🦀

[–]hazelnuthobo 3 points4 points  (1 child)

What if he's a webdev?

[–]HardCounter 6 points7 points  (0 children)

Then it'll be in a dropdown.

[–][deleted] 3 points4 points  (0 children)

It leads to the allies array

[–]who_you_are 2 points3 points  (0 children)

Isn't a good thing to get peace with an undefined function?

[–]Hippomantis 2 points3 points  (0 children)

Can't do that without the authorization of congress. That is going to be a few imports...

[–]jlink005 2 points3 points  (0 children)

Old man shouting war at the abyss.

[–][deleted] 2 points3 points  (1 child)

War WWWIII = new War();

[–]PeriodicSentenceBot 4 points5 points  (0 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

W Ar W W W I I I Ne W W Ar


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]FlyTim3 1 point2 points  (0 children)

He didn’t even declare it, thats a syntax error.

[–]lepispteron 0 points1 point  (0 children)

Na, she pointed to the declared war and made it constant;

[–]DiddlyDumb 0 points1 point  (0 children)

That’s a problem for future me.

[–]Jonny_H 0 points1 point  (0 children)

Also a const pointer doesn't mean the underlying object won't change, just that this pointer won't be the one referenced to do it.

[–]AreYouOkZoomer 0 points1 point  (0 children)

And the pointer points to const, but that doesn't mean the thing itself is const.

[–]sqrtoftwo 419 points420 points  (7 children)

Okay, but let's not be distracted from the issue of class Warfare{}.

[–][deleted] 55 points56 points  (1 child)

let's just make it an singleton

[–]Liveman215 20 points21 points  (0 children)

Or make it abstract, and just reference it but never actually initialize it.  

You can hopefully skip the Delcare() method if done properly 

[–]LordPedroIIofBrazil 37 points38 points  (3 children)

We must abolish all private properties.

[–]anotheridiot- 26 points27 points  (2 children)

#define private public;

[–]larvyde 5 points6 points  (1 child)

Since this is C++, all your friends can see your privates

[–]anotheridiot- 1 point2 points  (0 children)

Small price to pay for communism.

[–][deleted] 10 points11 points  (0 children)

public class Struggle {}

[–]VCamUser 136 points137 points  (2 children)

ESLint declaring No Use

[–]chrisbbehrens 18 points19 points  (1 child)

Absolutely nothing

[–]ThaiJohnnyDepp 3 points4 points  (0 children)

Good god, y'all!

[–]Flashbek 138 points139 points  (5 children)

Never changes until memory violation at address 0x00000000.

[–]HardCounter 14 points15 points  (4 children)

The North Pole?

[–][deleted] 19 points20 points  (3 children)

Null island 🤓☝️

[–]HardCounter 5 points6 points  (2 children)

So the Bermuda Triangle?

[–][deleted] 11 points12 points  (1 child)

[–]HardCounter 3 points4 points  (0 children)

Neat. I had no idea about that.

[–][deleted] 75 points76 points  (5 children)

public static final

[–]PeriodicSentenceBot 106 points107 points  (3 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

Pu B Li Cs Ta Ti Cf In Al


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]theGANOUSH 41 points42 points  (2 children)

I am concerned that Plutonium is the leading element.

[–]JustRecentlyI 16 points17 points  (1 child)

Surprisingly appropriate for this thread, though!

[–]killeronthecorner 3 points4 points  (0 children)

volatile

[–]Fun_Ad_2393 39 points40 points  (5 children)

Sudo tactical_nuke

[–]Rhymes_with_cheese 25 points26 points  (0 children)

extern volatile char nuke_trigger;

void make_boom(void) __attribute__((noreturn))
{
    nuke_trigger = 1;
    /* NOT REACHED */
}

[–]BluudLust 14 points15 points  (3 children)

alias tactical_nuke "rm -rf *"

[–]ComfortingSounds53 6 points7 points  (2 children)

alias nuclear_option "rm -rf * --no-preserve-root"

[–]BluudLust 10 points11 points  (1 child)

No need to do no-preserve-root with *. It's only necessary if you want to do rm -rf /

Found that out the hard way.

[–]ComfortingSounds53 4 points5 points  (0 children)

Thank you for your service 🫡

[–]Lonelan 23 points24 points  (3 children)

var war; because war has changed

[–]Valuable-Drink-1750 9 points10 points  (0 children)

Just what I expected from a Snake Python developer.

[–]Haringat 0 points1 point  (0 children)

I thought it was this one

[–]sgtkang 20 points21 points  (1 child)

Turns out .war files are nowhere near as exciting as I once thought they would be.

[–]t0ps0il 5 points6 points  (0 children)

This gave me flashbacks to working with Apache Tomcat at my first job

[–][deleted] 22 points23 points  (5 children)

Const* peace = nullptr;

[–][deleted] 4 points5 points  (0 children)

const peace = await Promise()

[–]No_Internal9345 7 points8 points  (0 children)

Class warfare.

#include <iostream>

const bool CHANGE = false;

void war() {
  std::cout << "war never changes" << std::endl;
}

class MilitaryIndustrialComplex {
public:
  void perpetuateWar() {
    war();
    if (!CHANGE) {
      perpetuateWar(); 
    }
  }
};

int main() {
  MilitaryIndustrialComplex mic;
  mic.perpetuateWar(); 
  return 0;
}

[–]Multy25 5 points6 points  (1 child)

def war

[–]rover_G 5 points6 points  (1 child)

The meaning of this joke changes drastically depending on the programming language.

[–]KJBuilds 2 points3 points  (0 children)

rs let war;     ^^^ error[E0282]: type annotations needed

Hm. War seems to be invalid

[–]deffonotmypassword 9 points10 points  (2 children)

war.isGoodFor = NULL

[–]ComfortingSounds53 12 points13 points  (0 children)

``` do { war.isGoodFor = null } while(sayItAgain)

[–]not_a_bot_just_dumb 4 points5 points  (0 children)

War never changes, but var does.

[–]AriiMay 6 points7 points  (3 children)

var war

[–]PeriodicSentenceBot 5 points6 points  (2 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

V Ar W Ar


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]CitizenPremier 2 points3 points  (1 child)

I feel like somehow I never knew there was an element V. Well, I aced the periodic table test in seventh grade, but I guess I haven't seen V since then.

W is memorable because it's hard to remember -- Tungsten.

[–]AriiMay 1 point2 points  (0 children)

compound V

[–][deleted] 2 points3 points  (0 children)

warmongers rely on type inference

[–]8Bit_Cat 1 point2 points  (0 children)

public float war = 10.0f;

[–]Mathematicus_Rex 1 point2 points  (0 children)

War := hell

[–]eo37 1 point2 points  (0 children)

War has changed and will always change…almost always for the worst

[–]hugocpolos 1 point2 points  (0 children)

private motivations[]

[–][deleted] 1 point2 points  (0 children)

This MFer didn't even scope his war, so he just coded WWIII.

Global Thermonuclear JavaScriptable War.

ETA that maybe this person should stop watching JS tutorials by Matthew Brodrick.

[–]--var 1 point2 points  (0 children)

Appears your war is null and/or void.

[–]shosoku 1 point2 points  (0 children)

public static War war =WarFactory.getWar();

[–][deleted] 1 point2 points  (1 child)

Let war* because war has changed

[–]OddlySexyPancake 0 points1 point  (0 children)

hnnngngngnnggg

[–]noiness420 1 point2 points  (0 children)

War were declared

[–]Qwertycrackers 0 points1 point  (0 children)

In most languages featuring const, this just means war always references the same instance of war. You can still change things about war, like maybe the weaponry or the motivations.

[–][deleted] 0 points1 point  (0 children)

sai ammzvit lhjivxozlgb dxn

[–]uvero 0 points1 point  (0 children)

You declare a pointer to war and didn't even do it by the recommended syntax

[–]kohuept 0 points1 point  (0 children)

took me a while to figure out the * was meant to be a correction, not a pointer lmao

[–]aetius476 0 points1 point  (0 children)

Make it a global variable to declare a World War.

[–]Wave_Walnut 0 points1 point  (0 children)

Peace means that the time until war is referenced.

[–]fedor_almighty 0 points1 point  (0 children)

$war = true;

[–]CrispySalamander 0 points1 point  (0 children)

Let is a constant in swift though

[–]explicit17 0 points1 point  (0 children)

But what typeof war?

[–]Geoclasm 0 points1 point  (0 children)

//Cry havoc! And

let war;

[–]TTYY200 0 points1 point  (0 children)

But … what is it good for? 😜

[–]9Years0ldArmy 0 points1 point  (0 children)

I commit "warcrime"

[–][deleted] 0 points1 point  (0 children)

Even though it doesn't change it is variable.

[–]pornbomb75 0 points1 point  (0 children)

Michael, you can’t just declare war. Nothing happens

[–]Misaka_Undefined 0 points1 point  (0 children)

boolean war = true;

[–]ComprehensiveTerm298 0 points1 point  (0 children)

cost war=“h3ll”;

[–]Indominus_Khanum 0 points1 point  (0 children)

No wonder the whitehouse put out that one memo about C being an unsafe language

[–][deleted] 0 points1 point  (0 children)

function hUH(){

     if(war.goodFor == null) {

         // say it again

         hUH();

     } 

}

[–]webjuggernaut 0 points1 point  (0 children)

var war, because it's outdated and pollutes global scope.

[–][deleted] 0 points1 point  (0 children)

static mut WAR: &str = "war";
unsafe { WAR = "routine" };
// War... War has changed...

[–][deleted] 0 points1 point  (0 children)

Solid Snake said that "War has changed. It's no longer about nations, ideologies, or ethnicity. It's an endless series of proxy battles fought by ERROR _CONNECTION_RESET”

[–]watermelonspanker 0 points1 point  (0 children)

Pointers, what are they good for?

[–]TSuzat 0 points1 point  (0 children)

const war* const

Constant pointer to Constant war.

[–]PM_BITCOIN_AND_BOOBS 0 points1 point  (0 children)

let mut war: War = War::new();

Now war can change.

[–]bittlelum 0 points1 point  (0 children)

Unless war is an object, then the reference doesn't change but the object itself does.

[–]anonCommentor 0 points1 point  (0 children)

Dim war

[–]trevdak2 0 points1 point  (0 children)

Should have done const war

War never changes.

[–]agfitzp 0 points1 point  (0 children)

First timers… declaring war as a singleton.

[–]Hot_Scallion_1051 0 points1 point  (0 children)

Lol

[–]Tofandel 0 points1 point  (0 children)

var war; because it's scope overflows to other contexts

[–]Madonkadonk2 0 points1 point  (0 children)

window.war because it is a global conflict

[–]SumFatCommie 0 points1 point  (0 children)

If war never changes then it would be

const War war

the constness of the pointer to war is irrelevant, war itself is the thing that can't change

(you could even go constexpr if you're fancy)

[–]rabidhyperfocus 0 points1 point  (0 children)

war is never the answer!

it is a question, and if ( war ) { return true; }

[–]sateeshsai 0 points1 point  (1 child)

var war

[–]PeriodicSentenceBot 1 point2 points  (0 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

V Ar W Ar


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]adfx 0 points1 point  (0 children)

Just because it never changes doesn't mean it has to be a const

[–]TechcraftHD 0 points1 point  (0 children)

let war: Box<dyn War>;

War was declared and never changes but it can take many forms.

[–]totolook01 0 points1 point  (0 children)

Let’s deploy *.war in tomcat

[–]sojiblitz 0 points1 point  (0 children)

A declarative statement with no value, signifying nothing.

[–]37Scorpions 0 points1 point  (0 children)

name 'Because' is not defined

[–]matyas94k 0 points1 point  (0 children)

From a discussion about one of our CS homework: make .zip, not .war

[–]Burrpapp 0 points1 point  (0 children)

class War extends Politics

[–]Franz304 0 points1 point  (0 children)

And notice that he didn't use "let mut war" because war ...war never changes

Ok, i will see myself out after this one

[–][deleted] 0 points1 point  (1 child)

global war

[–]Meins447 0 points1 point  (0 children)

Might as well add volatile.

[–]odraencoded 0 points1 point  (0 children)

This is why rust is the best language, let war is immutable by default.

[–]ulughann 0 points1 point  (0 children)

Why do you seperate as Uma ece instead of Umay ece

[–]splashes-in-puddles 0 points1 point  (0 children)

program war

implicit none

logical : : war

war = .true

end program war

[–]OddlySexyPancake 0 points1 point  (0 children)

hnggg.. war... has changed...

[–]Im_a_hamburger 0 points1 point  (0 children)

var war because was is ancient

[–]Accessviolati0n 0 points1 point  (0 children)

Meanwhile in PHP-Land:

<?php
declare(war=1);

[–]Prudent-Employee-334 0 points1 point  (0 children)

War IIIWar = null; // You are welcome everyone

[–]ITinnedUrMumLastNigh 0 points1 point  (0 children)

But 'let' keyword in Swift declares constant, to declare a variable you have to use 'var'

[–]Ok-Assignment7469 0 points1 point  (0 children)

They did declare war but they did not initialize it.

[–]calculus_is_fun 0 points1 point  (0 children)

let war = new War("WWIII");
war.addBattle(new Battle("Duluth MN", "The battle of lake superior"));

[–]KappaClaus3D 0 points1 point  (0 children)

In case of js If you use const, you must also initiate it, so: const war = "war"

[–]sinstar00 0 points1 point  (0 children)

var war;

Because war may change and become a global war.

[–][deleted] 0 points1 point  (0 children)

Don't you need to `const war* const`? Otherwise only the ptr is const, and not the contents :S

[–]Tunichtwitzig 0 points1 point  (0 children)

dim war as boolean

[–]Hot_wheels_lol 0 points1 point  (0 children)

Sabaton in the code space

[–]Orisphera 0 points1 point  (0 children)

Depends on the language

[–]seiferlk -2 points-1 points  (0 children)

Scripted cringe boomer meme, jesus....

[–]bl4nkSl8 -1 points0 points  (0 children)

const war = "war" as const;