I spent too much time trying to remember "how to do atoi() in Perl" when you don't need to do that in Perl, it makes no distinction between numbers and strings, you can just do
my $N = shift @ARGV;
$N > 0 || die("Arg must be > 0");
@vaporeon_ oh does it kill program execution and log the given message to console?
@wallhackio By the way, if you have installed Perl on your machine (if you're still on Debian, that should be trivial, just apt-get install perl), you could do perldoc -f die to find out what the function die does!
@wallhackio "log the given message to console" is a very JavaScript-brained way of saying "print the given message to stderr"...
@vaporeon_ javascript is the only real language, everything else is an imitation
@wallhackio This is slander of the C programming language ![]()
@vaporeon_ I mean, its syntax was inspired by javascript so it's still a great language :]
@wallhackio
It is JavaScript that was inspired by C, there was no JavaScript in the 1970s, but there was C
@vaporeon_ if c had dynamic typing it would be perfect :]
@wallhackio You should try the programming language B, it's the ancestor of C and it doesn't have datatypes ![]()
@wallhackio Disclaimer: I don't know whether you actually can run it on a modern computer... But you can always emulate a PDP-11 with SIMH!
@vaporeon_ oh shit really? 👀
also I was joking I don't have problems with C's typing
@wallhackio Here's a web page about it: https://www.nokia.com/bell-labs/about/dennis-m-ritchie/bintro.html
B only has the machine word, there no distinctions between char, int, or pointers, and as far as I know, it doesn't have structs either
That's why it was superceded by C
@wallhackio I don't think it's a practical language for modern-day use
But if you want C without datatypes
You can get C without datatypes
Have fun LOL
@vaporeon_ oh no structs? :(((((((
@vaporeon_ structs are one of the best things in c
@wallhackio Yeah
Structs were one of the big improvements that C had over B
They're even the reason why they could rewrite the UNIX kernel in C instead of assembly:
By early 1973, the essentials of modern C were complete. The language and compiler were strong enough to permit us to rewrite the Unix kernel for the PDP-11 in C during the summer of that year. (Thompson had made a brief attempt to produce a system coded in an early version of C—before structures—in 1972, but gave up the effort.)
@wallhackio @vaporeon_ functions named die that work like that seem to be a general convention; i’ve seen it manually defined to work like that in several codebases
@wallhackio Yes, exactly!