Timeline for Where are octals useful? [closed]
Current License: CC BY-SA 3.0
38 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 17, 2017 at 0:39 | review | Reopen votes | |||
| Nov 21, 2017 at 3:00 | |||||
| May 4, 2017 at 16:43 | comment | added | supercat |
...also being allowed to reject it in favor of the new usages when compatibility with old code was not required. Had C89 done that, later standards could have added #pragma directives to specify whether numbers with leading zeroes should be interpreted as octal, decimal, or "error" [with the latter being the default] and such usage would have made it possible to use token pasting to assemble strings of digits into a form that could be either processed as a decimal literal or fed to the stringize operator.
|
|
| May 4, 2017 at 16:42 | comment | added | supercat | @5gon12eder: IMHO, the C Standard should long ago have deifned a standard macro which, when given a string of digits 0-7 with or without a leading zero, would regard it as an octal number, and also defined either 0q123 or 8x123 as a syntax for writing octal constants ("q" instead of "o" is a convention used in many assemblers because "q" is visually distinct from "o"; the latter could easily be adapted for any base up to 36). Use of leading zeroes for any non-zero integer literals could then be deprecated, with compilers allowing such usage if necessary to support old code, but... | |
| Sep 15, 2015 at 15:26 | history | closed |
CommunityBot Kilian Foth gnat |
Needs more focus | |
| Sep 15, 2015 at 9:23 | answer | added | Julia Hayward | timeline score: 2 | |
| Sep 15, 2015 at 4:34 | comment | added | 5gon12eder |
@Steve314 I totally agree. Another noteworthy example is Python where they have the 0o prefix (which is consistent with 0x and 0b but perhaps a little hard to distinguish from 00). And since Python 3, extra leading zeros a re a syntax error to prevent this kind of bugs.
|
|
| Sep 14, 2015 at 22:21 | comment | added | supercat | Octal is sometimes useful, but I find myself totally flummoxed as to why anyone desinging a new language would use 031 as a notation for twenty-five, rather than e.g. 31q, 0q31, @31 [if @ has no other meaning], etc. | |
| Sep 14, 2015 at 22:01 | review | Close votes | |||
| Sep 15, 2015 at 15:26 | |||||
| Sep 14, 2015 at 19:32 | history | protected | CommunityBot | ||
| Jan 20, 2014 at 14:52 | comment | added | Petruza | PS: Someone edited my question from "who uses octal?", which is pretty different from what's now the question. (this was edited out from my original question) | |
| Jan 20, 2014 at 14:50 | comment | added | Petruza | @Arian and C, C++ and many other languages that use the 0 notation | |
| Jan 19, 2014 at 7:49 | comment | added | Cephalopod | Option D: "blame PHP" is always the right choice, regardless of the problem | |
| Jan 18, 2014 at 0:41 | review | Close votes | |||
| Jan 24, 2014 at 3:01 | |||||
| Aug 6, 2011 at 7:50 | comment | added | user8 | @Petruza Your question in its original form was not constructive for this site, and it was improved by the community so that it could remain open: please see the FAQ for more information about why people do this and why we encourage it. If you have any additional questions or concerns, please raise them on our meta-discussion site, not in your question. | |
| Aug 6, 2011 at 7:46 | history | rollback | user8 |
Rollback to Revision 5
|
|
| Aug 6, 2011 at 7:11 | review | Suggested edits | |||
| Aug 6, 2011 at 7:52 | |||||
| Aug 6, 2011 at 6:52 | history | edited | Petruza | CC BY-SA 3.0 |
added 362 characters in body
|
| Aug 6, 2011 at 6:49 | comment | added | Petruza | @job: I blame myself 100%. I know octal notation and should have realised. But still, who uses octals anymore? | |
| Aug 6, 2011 at 6:47 | history | edited | Petruza | CC BY-SA 3.0 |
added 362 characters in body
|
| Aug 6, 2011 at 6:44 | vote | accept | Petruza | ||
| Aug 5, 2011 at 3:39 | history | tweeted | twitter.com/#!/StackProgrammer/status/99323497792282625 | ||
| Aug 5, 2011 at 2:39 | answer | added | tylerl | timeline score: 7 | |
| Aug 4, 2011 at 23:05 | answer | added | Jerry Coffin | timeline score: 5 | |
| Aug 4, 2011 at 22:16 | comment | added | user8709 | @Petrozza - IMO the C-style use of a leading zero to indicate octal was never a good choice, but it's history - probably a bit of C heritage, though it may be even older. I think Ada has one of the better conventions - an octal number would be written 8#1234567#, a hex number 16#abcdef#, etc and leading zeros are just leading zeros - any base from 2 to 16 (at least) is valid, and all are visually obvious and easy to understand. | |
| Aug 4, 2011 at 21:05 | answer | added | Abel | timeline score: 47 | |
| Aug 4, 2011 at 20:12 | history | edited | Michael K | CC BY-SA 3.0 |
added 20 characters in body; edited title
|
| Aug 4, 2011 at 20:05 | answer | added | tcrosley | timeline score: 17 | |
| Aug 4, 2011 at 19:51 | answer | added | back2dos | timeline score: 3 | |
| Aug 4, 2011 at 19:41 | history | edited | Catchops | CC BY-SA 3.0 |
Making this Post Rated PG.
|
| Aug 4, 2011 at 19:02 | answer | added | Majenko | timeline score: 5 | |
| Aug 4, 2011 at 18:55 | history | edited | Robert Harvey | CC BY-SA 3.0 |
added 4 characters in body
|
| Aug 4, 2011 at 18:53 | answer | added | Robert Harvey | timeline score: 10 | |
| Aug 4, 2011 at 18:50 | comment | added | Job | Option A: Blame yourself. Option B: Blame the world. Option C: chuckle as you have learned something. | |
| Aug 4, 2011 at 18:48 | answer | added | Ed Swangren | timeline score: 2 | |
| Aug 4, 2011 at 18:47 | answer | added | Blrfl | timeline score: 5 | |
| Aug 4, 2011 at 18:44 | answer | added | Caleb | timeline score: 3 | |
| Aug 4, 2011 at 18:38 | history | edited | FrustratedWithFormsDesigner |
edited tags
|
|
| Aug 4, 2011 at 18:35 | history | asked | Petruza | CC BY-SA 3.0 |