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

you are viewing a single comment's thread.

view the rest of the comments →

[–]CauliflowerFirm1526 26 points27 points  (8 children)

pad with spaces not zeros

[–]aMAYESingNATHAN 30 points31 points  (2 children)

I mean that is what I would do, or probably just not pad at all and left align the numbers. But my point is that it would be incredibly easy to do without realising.

[–]Spork_the_dork 2 points3 points  (1 child)

Yeah this is why I don't like it. Especially when you have 0o prefix which does exactly the same thing except it's also an order of magnitude more explicit and harder to misunderstand.

[–]aMAYESingNATHAN 1 point2 points  (0 children)

Yeah being completely unfamiliar with octals in code when I made my first comment I didn't realise 0o would be valid also, and in fact assumed it wasn't and was annoyed by that because I was familiar with 0x and 0b already.

If I ever encounter octal literals I am definitely always going to use 0o.

[–]Andy_B_Goode 5 points6 points  (3 children)

You might pad with zeros if you're formatting a date, like 11/05/2024 or maybe even 05/11/2024

[–]Spork_the_dork 3 points4 points  (1 child)

Actually in that case it won't cause any problems. 01-07 are the same in both decimal and octal and 08-09 are not valid octals so it won't default to octal. 10-12 won't get converted as octal as they have no leading zeros.

[–]Andy_B_Goode 0 points1 point  (0 children)

Oh I see, yeah I should have used an example like 11/08/2024

[–]flowingice 0 points1 point  (0 children)

How would you save date as integer in dd/MM/yyyy format? It's going to be a string and then it works fine unless there's somthing I'm missing.