Timeline for Ot wes thi bist uf tomis
Current License: CC BY-SA 4.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 29, 2021 at 11:24 | comment | added | Neil | The ungolfed version should really have the array indexing the "traditional" way around. | |
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Aug 2, 2018 at 22:27 | comment | added | ceilingcat |
@Rogem Because of the commutative property of addition, a[b]==*(a+b)==*(b+a)==b[a] . Therefore 1[...]==(...)[1]
|
|
Aug 2, 2018 at 21:15 | comment | added | user77406 |
I'm curious as to what does 1[…] do?
|
|
Aug 2, 2018 at 10:39 | history | edited | O.O.Balance | CC BY-SA 4.0 |
added 109 characters in body
|
Apr 26, 2018 at 8:36 | history | edited | O.O.Balance | CC BY-SA 3.0 |
added 21 characters in body
|
Apr 25, 2018 at 9:31 | comment | added | Christoph |
@PeterCordes yeah I found out about it here after having a suspicion. Anyway here another 2 bytes saved f(char*c){for(;*c;)putchar(1[strchr("AEIOUAaeioua",*c++)?:c-2]);} . That's all for now I guess.
|
|
Apr 25, 2018 at 9:14 | comment | added | Peter Cordes |
@Christoph: I was curious where the undefined behaviour was, so I debugged the clang version, after ungolfing it some more. const char *res = strchr("AEIOU...", 0) returns a pointer to terminator in the string literal. putchar(res[1]) reads past the end of the string literal. With gcc it apparently happens to find another zero byte and it happens to work, but with clang it gets a 73 'I' (probably from main 's string literal, "It was...", but I didn't check the asm). So putchar doesn't return 0, and we eventually segfault when *c++ reads an unmapped page.
|
|
Apr 25, 2018 at 8:20 | comment | added | O.O.Balance |
@Christoph I like your use of recursion, but I'm not sure we can output a trailing \0 . Also, this does not work when compiled with clang: tio.run/##S9ZNzknMS///…
|
|
Apr 25, 2018 at 6:54 | comment | added | Christoph |
Can we output a final "\0" ? If yes then f(char*c){putchar((strchr("AEIOUAaeioua",*c++)?:c-2)[1])&&f(c);} works just fine.
|
|
Apr 24, 2018 at 14:14 | comment | added | Christoph | Seems to be a none standard extension from gcc. I knew it from php and simply tried it. | |
Apr 24, 2018 at 13:46 | comment | added | O.O.Balance |
@Christoph very nice. I had no idea you could leave out the second operand to ?: .
|
|
Apr 24, 2018 at 13:46 | history | edited | O.O.Balance | CC BY-SA 3.0 |
added 48 characters in body
|
Apr 24, 2018 at 13:19 | comment | added | Christoph |
f(char*c){for(;*c;)putchar((strchr("AEIOUAaeioua",*c++)?:c-2)[1]);} works for me (gcc 7.3).
|
|
Apr 24, 2018 at 10:06 | comment | added | O.O.Balance | @KevinCruijssen Thanks! | |
Apr 24, 2018 at 10:05 | history | edited | O.O.Balance | CC BY-SA 3.0 |
added 31 characters in body
|
Apr 24, 2018 at 9:46 | comment | added | Kevin Cruijssen |
Oh, and one more byte with either this: f(char*c){for(char*p;*c;c++)putchar((p=strchr("AEIOUAaeioua",*c))?*++p:*c);} . Or this: f(char*c){for(char*p;*c;putchar(p?*++p:*c),c++)p=strchr("AEIOUAaeioua",*c);}
|
|
Apr 24, 2018 at 9:41 | comment | added | Kevin Cruijssen |
You can save 7 bytes by using "AEIOUAaeioua" directly, so you can drop int*t=...; , since you only use t once.
|
|
Apr 24, 2018 at 9:24 | history | answered | O.O.Balance | CC BY-SA 3.0 |