Skip to main content
13 events
when toggle format what by license comment
Oct 26, 2017 at 12:42 comment added Jens @AlbertRenshaw I don't think this works, because the argument declaration is equivalent to int *i and will neither allocate memory nor crash.
Oct 26, 2017 at 2:33 history edited Steadybox CC BY-SA 3.0
deleted 7 characters in body
Feb 10, 2017 at 10:54 comment added Albert Renshaw You can golf off 1byte by doing this main(int i[~0u]){}
Nov 21, 2016 at 16:33 comment added Karl Napf Nothing accesses the array, so it is not generated and no error. At least initializing or using it is necessary to error.
Oct 6, 2015 at 16:47 comment added Jens @FUZxxl Interesting; are your ints 32 bit? If so, sizeof(i) is 16GB. Does using an ul or ull suffix make a difference? Some systems over-commit memory and only crash if the memory is written to.
Oct 6, 2015 at 12:58 comment added FUZxxl Doesn't work for me after I manually configured a 4GB stack.
Feb 26, 2014 at 9:58 history edited Jens CC BY-SA 3.0
Fix code as suggested
Feb 25, 2014 at 16:00 comment added Csq it gives main.c:1:16: error: size of array 'i' is negative for me on gcc 4.8.1. The unsigned version main(){int i[~0U];} works.
Feb 2, 2014 at 17:49 comment added Tomas OK, sorry, accepted.
Feb 2, 2014 at 17:45 comment added Jens @Thomas Yes it is a stack overflow on any machine where local variables are allocated on the stack. Since the C language has no concept of a stack overflow indication (it's all undefined behavior; one of them manifests itself as a segfault), this does fit the original requirement.
S Nov 6, 2013 at 12:41 review Low quality posts
Nov 7, 2013 at 3:04
S Nov 6, 2013 at 12:41 review First posts
Nov 6, 2013 at 14:53
Nov 6, 2013 at 12:25 history answered Jens CC BY-SA 3.0