Skip to main content

Timeline for Decide a C integer literal

Current License: CC BY-SA 4.0

31 events
when toggle format what by license comment
Sep 5 at 17:33 answer added Toby Speight timeline score: 3
Sep 5 at 10:50 comment added Explorer09 0o is proposed in the C2y standard. Some compilers have already implemented it as an extension.
Sep 5 at 9:20 comment added Dannyu NDos @Explorer09 0b, yes. 0o, no.
Sep 5 at 8:29 comment added Explorer09 This challenge looks outdated so quickly. Modern C supports 0b and 0o literal prefixes now.
Sep 5 at 4:16 answer added a stone arachnid timeline score: 3
Sep 4 at 19:49 answer added Adamátor timeline score: 2
Dec 10, 2020 at 15:10 comment added Lundin Would this be considered cheating? void is_integer_literal (const char* str) { FILE*f=fopen("z","w"); fprintf(f,"main(){%s;}",str); fclose(f); system("gcc z"); system("echo $?"); }. I'm not sure if there's an online compiler which allows me to make syscalls though :)
Nov 8, 2020 at 3:00 history tweeted twitter.com/StackCodeGolf/status/1325272053587521537
Oct 19, 2020 at 21:43 vote accept Dannyu NDos
Oct 14, 2020 at 23:12 history edited Dannyu NDos CC BY-SA 4.0
deleted 8 characters in body
Oct 14, 2020 at 22:03 history edited Dannyu NDos CC BY-SA 4.0
added 21 characters in body
Oct 14, 2020 at 20:43 comment added A. Rex @GregMartin: I believe the combination should include one of the us and one of the ls and so this should be the full list (in addition to the empty modifier): U u L l LL ll UL Ul ULL Ull uL ul uLL ull LU lU LLU llU Lu lu LLu llu
Oct 14, 2020 at 20:08 answer added pxeger timeline score: 2
Oct 14, 2020 at 16:22 comment added Greg Martin "Any combination of the above", as written, seems to include many of the possibilities you list as invalid examples (Ll for example). Can you clarify what combinations are allowed?
Oct 14, 2020 at 16:21 comment added lynn Suggested test case: 0o765. This is a valid octal literal in many languages that might try to get away with a built-in "eval" / "read-int" sort of approach, but it's not valid C.
Oct 14, 2020 at 13:34 answer added skytomo timeline score: 6
Oct 14, 2020 at 12:56 comment added Peter Cordes Suggested test-case: 2-1 (starts with a digit and is a valid C constant-expression, but not a bare integer literal). So for example feeding a=2-1; or a[2-1]; to a C compiler wouldn't reject it. (Working on a bash answer that uses cc -c after testing the first digit, trying to let a compiler do the heavy lifting.)
Oct 14, 2020 at 12:12 answer added lynn timeline score: 1
Oct 14, 2020 at 11:15 answer added Neil timeline score: 2
Oct 14, 2020 at 10:07 answer added Noodle9 timeline score: 2
Oct 14, 2020 at 8:57 answer added Kevin Cruijssen timeline score: 2
Oct 14, 2020 at 8:46 comment added AZTECCO Suggested test case for floating point values
Oct 14, 2020 at 8:33 comment added Kevin Cruijssen Suggested falsey test cases: 1L1L, 0xabucdlu (or any other test case with an l/L/u somewhere in the middle, making it invalid).
Oct 14, 2020 at 8:11 answer added Kevin Cruijssen timeline score: 5
Oct 14, 2020 at 7:53 history became hot network question
Oct 14, 2020 at 7:02 answer added Arnauld timeline score: 2
Oct 14, 2020 at 5:01 answer added Xcali timeline score: 5
Oct 14, 2020 at 0:10 answer added Neil timeline score: 9
Oct 14, 2020 at 0:04 answer added hyperneutrino timeline score: 3
Oct 13, 2020 at 23:59 answer added hyperneutrino timeline score: 4
Oct 13, 2020 at 23:50 history asked Dannyu NDos CC BY-SA 4.0