Witchcraft not sufficient to understand octal numbers
-
-
-
witches.live? sounds fake :blobcatsip:
-
@anna-thewitch said in Witchcraft not sufficient to understand octal numbers:
witches.live? sounds fake :blobcatsip:
pull requests encouraged
-
you have but no :oghno: or :blobcatsip: this is tragic
-
also this is the only time i have ever used the phrase "moon code" and been completely literal about it, even though i was describing code translated from javascript to ruby line by line by some DIPWAD who hasnt done a lot of ruby, so i guess there is a lot of moon code going on actually
-
@anna-thewitch hi!
@ben_lubar you realize we don't give out badges that that anymore, right?
-
@Tsaukpaetra said in Witchcraft not sufficient to understand octal numbers:
@anna-thewitch hi!
@ben_lubar you realize we don't give out badges that that anymore, right?
I could give myself a badge I have the icon
-
@anna-thewitch Welcome to the forums!
-
@anna-thewitch said in Witchcraft not sufficient to understand octal numbers:
you have but no :oghno: or :blobcatsip: this is tragic
PRs accepted!
-
@anna-thewitch said in Witchcraft not sufficient to understand octal numbers:
also this is the only time i have ever used the phrase "moon code" and been completely literal about it
You're in good company:
https://www.nytimes.com/1992/11/27/us/moon-is-blamed-for-blips-in-a-particle-accelerator.html
-
inb4 "TRWTF is JS", "
parseInt
should be able to read my mind and convert0xff
but not08
", blablablaalso, Ruby already supports
Integer('08', 10)
or'08'.to_i(10)
since... 1.9.2? So it's nice to know that not only JS is full of people of WTF, Rubyists do too.
-
@_P_ Ruby has Jeff. Enough said.
-
@ben_lubar said in Witchcraft not sufficient to understand octal numbers:
I could give myself a badge I have the icon
Start by giving yourself a few punctuation characters to use in your posts.
-
@cvi said in Witchcraft not sufficient to understand octal numbers:
@ben_lubar said in Witchcraft not sufficient to understand octal numbers:
I could give myself a badge I have the icon
Start by giving yourself a few punctuation characters to use in your posts.
Where's :whomst'd've:?
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
inb4 "TRWTF is JS", "
parseInt
should be able to read my mind and convert0xff
but not08
", blablablaalso, Ruby already supports
Integer('08', 10)
or'08'.to_i(10)
since... 1.9.2? So it's nice to know that not only JS is full of people of WTF, Rubyists do too.Surely, you mean TRWTF is converting a date to string just to parse out the day again instead of using the
day
method. I mean, there has to be aday
method, right?!
-
@topspin It does have an mday method...
Maybe somebody mistakenly thought it stood for "mayday"?
-
@JBert
if that was the case it should have been called frequently through that code
-
The real is
ParseInt
, on a modern language, accepting a string as a octal representation without a format/base specifier. I've only used octal on embedded, never on anything else. Without a base specifier then a base-10 radix should be assumed, it's what ≈100% of people will want.
-
@Cursorkeys said in Witchcraft not sufficient to understand octal numbers:
The real is
ParseInt
, on a modern language, accepting a string as a octal representation without a format/base specifier. I've only used octal on embedded, never on anything else. Without a base specifier then a base-10 radix should be assumed, it's what ≈100% of people will want.The real is using a leading "0" to specify octal instead of, say, "0o", to be similar to "0x" for hexadecimal and "0b" for binary.
-
@Khudzlin said in Witchcraft not sufficient to understand octal numbers:
@Cursorkeys said in Witchcraft not sufficient to understand octal numbers:
The real is
ParseInt
, on a modern language, accepting a string as a octal representation without a format/base specifier. I've only used octal on embedded, never on anything else. Without a base specifier then a base-10 radix should be assumed, it's what ≈100% of people will want.The real is using a leading "0" to specify octal instead of, say, "0o", to be similar to "0x" for hexadecimal and "0b" for binary.
Most modern languages do not parse
0b
as binary automatically either, only0x
as hexadecimal.Also, octal is a completely historical thing and the only place where it's commonly use today is nothing but Unix file permission settings. So the real is Unix?
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
-
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
is Rust's parsing function. C and C++ merely copied from Rust.
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
So the real is Unix?
Yes, very much. For restricting file permissions info to 9 bits.
-
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
C++14 standardized 0b for binary integer literals.
(So, as far as I care, most modern languages do support 0b. )
-
@JBert said in Witchcraft not sufficient to understand octal numbers:
@topspin It does have an mday method...
-
Things that are TRWTF:
- octal
- Unix
- Ruby
- Jeff Atwood
- JS
- converting a date to string to parse the day
- parseInt
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
is Rust's parsing function. C and C++ merely copied from Rust.
Why? That's just an infixer for the actual parsing method. A somewhat pointless one, because most of the time you have to use the turbofish¹ to specify the result type anyway, so it will rarely save you any typing.
But otherwise it is actually not a , because for integeral types it actually parses the string as decimal explicitly though undocumentedly.
¹ Do click the link, because that is (and then afford a couple of clicks to the “random” button at bottom right for some extra )
-
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
Languages I am aware of that have binary literals with
0b
prefix:- Java
- Rust
- C++
- Python
- C#
I don't think C currently has binary literals.
-
- JavaScript
-
@LB_ said in Witchcraft not sufficient to understand octal numbers:
I don't think C currently has binary literals.
I don't know if has been integrated into the official standard, but at least GCC and some other embedded compilers have supported the
0b
notation for a number of years.
-
@LB_ said in Witchcraft not sufficient to understand octal numbers:
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
Languages I am aware of that have binary literals with
0b
prefix:- Java
- Rust
- C++
- Python
- C#
I don't think C currently has binary literals.
0b
support at code level and0b
support in string to int conversion level are two completely different things. Unless you're implying thateval("0b101010")
is totally acceptable. I meant the latter when I say most language doesn't supporting converting0b
in native int parsing function.
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
0b
support at code level and0b
support in string to int conversion level are two completely different things.Only the first truly counts as language support. The other is runtime support.
-
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
0b
support at code level and0b
support in string to int conversion level are two completely different things.Only the first truly counts as language support. The other is runtime support.
Yeah but we're talking about
parseInt
the entire thread. Not sure how you'd perceive it as otherwise.
-
@Khudzlin said in Witchcraft not sufficient to understand octal numbers:
@Cursorkeys said in Witchcraft not sufficient to understand octal numbers:
The real is
ParseInt
, on a modern language, accepting a string as a octal representation without a format/base specifier. I've only used octal on embedded, never on anything else. Without a base specifier then a base-10 radix should be assumed, it's what ≈100% of people will want.The real is using a leading "0" to specify octal instead of, say, "0o", to be similar to "0x" for hexadecimal and "0b" for binary.
We shall overlook the small point that leading zero has beeen used to specify octal in C since before Kernighan and Ritchie wrote their small book about the C programming language. TR is not being aware that
0010
is 8 and0100
is 64, and that this has been the case since the 1970s.(1)(1) I said the word "octal" to a colleague who had been bitten by this in 1992, ffs. He realised straight away what he had done.
EDIT: English-language tense error fixed. The past of "write" is not "write".
-
@Zerosquare said in Witchcraft not sufficient to understand octal numbers:
@LB_ said in Witchcraft not sufficient to understand octal numbers:
I don't think C currently has binary literals.
I don't know if has been integrated into the official standard, but at least GCC and some other embedded compilers have supported the
0b
notation for a number of years.GCC hasn't been specfically an embedded compiler for yonks, about the time they merged with the EGCS (pronounced "eggs", duh) fork.
EDIT: I feel compelled to note that GCC and EGCS merged about 20 years ago.
-
@Bulb said in Witchcraft not sufficient to understand octal numbers:
(and then afford a couple of clicks to the “random” button at bottom right for some extra )
-
@_P_ said in Witchcraft not sufficient to understand octal numbers:
@dkf said in Witchcraft not sufficient to understand octal numbers:
@_P_ said in Witchcraft not sufficient to understand octal numbers:
Most modern languages
By that, do you mean “C and C++ and that's all I care about”?
is Rust's parsing function. C and C++ merely copied from Rust.
Wat? Rust's
parse
function is just a shim overFromStr
, and int parsing does not interpret leading zero as octal.
-
@Steve_The_Cynic said in Witchcraft not sufficient to understand octal numbers:
GCC hasn't been specfically an embedded compiler for yonks, about the time they merged with the EGCS (pronounced "eggs", duh) fork.
My mistake. I first wrote "GCC and some other compilers", meant to change it to "GCC and some embedded compilers", and forgot to remove "other".
-
@Steve_The_Cynic said in Witchcraft not sufficient to understand octal numbers:
We shall overlook the small point that leading zero has beeen used to specify octal in C since before Kernighan and Ritchie wrote their small book about the C programming language.
Yeah it's old, but it's still a misfeature. From a mathematical standpoint, the fact that
42
and042
have different values is .
-
@HardwareGeek said in Witchcraft not sufficient to understand octal numbers:
@_P_ Ruby has Jeff. Enough said.
Whoa wait a damned minute. Back the fuck up.
Jeff Atwood is somehow involved in Ruby?
And we didn't troll him mercilessly for it?
-
@Steve_The_Cynic said in Witchcraft not sufficient to understand octal numbers:
GCC hasn't been specfically an embedded compiler
Nevertheless, it is much used in the world of embedded systems.
-
@Weng said in Witchcraft not sufficient to understand octal numbers:
Jeff Atwood is somehow involved in Ruby?
As a user of it, yes. RoR is one of the pieces of his Rube Goldberg contraption (unless I badly misremember).
-
@HardwareGeek The Ruby code isn't particularly objectionable, other than requiring a sparkling stampede of RAM-ravenous unicorns to perform better than a severely asthmatic snail. The is the ActiveRecord database annotations, which were tuned for exactly the wrong database backend and never properly load-tested until /t/1000, which was written up as anomalous user behavior until other customers started hitting it organically despite the low likes limit. Oh, and shelling out to ImageMagick to make letter avatars, to the point they had to build a CDN for it. And jellypotato and the way that client-side and server-side code interacted. And how sanitizing user input seemed to be an afterthought. But the actual Ruby code itself? Kind of ... normal.
Filed under: was letting Jeff play administrator.... Bonus NodeBB bug: Text after a horizontal rule seems to cut off after the first smiley, unless followed by at least one paragraph break, which itself gets turned into a line break. Don't you miss when the worst bug in the world was FUCKING HELL WHY DOES IT DELETE TWO CHARACTERS WHEN I PRESS BACKSPACE ONCE? @ben_lubar ?
-
@TwelveBaud said in Witchcraft not sufficient to understand octal numbers:
FUCKING HELL WHY DOES IT DELETE TWO CHARACTERS WHEN I PRESS BACKSPACE ONCE
In a cruel twist of fate, I now spend most of my time at work developing on the Community Server platform.
It's not as bad as we remember it.
It's worse.
Filed under: At least they pay me well.
-
@anna-thewitch said in Witchcraft not sufficient to understand octal numbers:
also this is the only time i have ever used the phrase "moon code" and been completely literal about it, even though i was describing code translated from javascript to ruby line by line by some DIPWAD who hasnt done a lot of ruby, so i guess there is a lot of moon code going on actually
Yeah, just be glad that it's only code that's dealing with minor aspects of our moon, and not, say, navigating accurately despite mascons or the likes
-
@Weng said in Witchcraft not sufficient to understand octal numbers:
@HardwareGeek said in Witchcraft not sufficient to understand octal numbers:
@_P_ Ruby has Jeff. Enough said.
Whoa wait a damned minute. Back the fuck up.
Jeff Atwood is somehow involved in Ruby?
And we didn't troll him mercilessly for it?
Yes, that's what Discourse is written in.
-
@pie_flavor said in Witchcraft not sufficient to understand octal numbers:
@Weng said in Witchcraft not sufficient to understand octal numbers:
@HardwareGeek said in Witchcraft not sufficient to understand octal numbers:
@_P_ Ruby has Jeff. Enough said.
Whoa wait a damned minute. Back the fuck up.
Jeff Atwood is somehow involved in Ruby?
And we didn't troll him mercilessly for it?
Yes, that's what Discourse is written in.
He should've written Discourse in Rust.
-
@_P_ Oh, definitely. Rocket and Yew are really good.
-
@pie_flavor said in Witchcraft not sufficient to understand octal numbers:
@Weng said in Witchcraft not sufficient to understand octal numbers:
@HardwareGeek said in Witchcraft not sufficient to understand octal numbers:
@_P_ Ruby has Jeff. Enough said.
Whoa wait a damned minute. Back the fuck up.
Jeff Atwood is somehow involved in Ruby?
And we didn't troll him mercilessly for it?
Yes, that's what Discourse is written in.
Oh. Using the language for a shit product and being responsible for the language are very different things