4 ms·
A void method that returns a value? How on earth did this coffeeshop compile?
by quarterto 13y ago
A void method that returns a value? How on earth did this coffeeshop compile?
- galaktor 13y agoHopefully they'll fix this in the next GTA patch.
- fennecfoxen 13y agoA void method that returns a sandwich, no less.
- RossM 13y agoRequires root user to run
- splatcollision 13y ago'sudo make me a sandwich'
- robinson-wall 13y ago-bash: sudo make me a sandwich: command not found
- laumars 13y agoI'm surprised you don't have make installed. That's usually one of the first tools I install on any new system (if it's not included as part of the base install, like Arch does): sudo apt-get install build-essential Incidentally, the make error you'd get is amusing: make: *** No rule to make target `me'. Stop.
- ushi 13y agosudo pacman -S make curl https://put.honkgong.info/ed8e3df8691ec7944a878cea595e00c363079504 > Makefile sudo make me a sandwich
- koenigdavidmj 13y agoLet's run arbitrary code downloaded from somewhere I don't know! As root!
- levosmetalo 13y agoDid you read the linked Makefile?
- koenigdavidmj 13y ago1. The posted code could change between when you read it and when I read it. 2. If you just cut-and-paste these three lines, then you are obviously not reading it.
- levosmetalo 13y agoThat's why you have another line saying something like: cat Makefile before blindly executing it. In general, you shouldn't blindly believe downloaded code, but in this case Makefile is simple enough that you can prove it's non harmful in a few second glance.
- es20641 13y agook
- deleted 13y ago[deleted]
- egwynn 13y agoNever mind that the function casts (coerces? constructs?) ints to bread and ints to bacon. Let alone how it's got a special "plus" operator that can work on bread/bacon and return a sandwich...
- cosmotron 13y agoIf you look carefully at the screenshot, you'll see that bread and bacon are declared to be ints above the method. =]
- galaktor 13y agoClearly bad practice to be using raw integers here. They should at least be using enums. public enum Ingredients { BREAD, BACON } public enum Delicatessen { BACON_SANDWICH }