Replies: 12 comments 22 replies
-
This is Obfuscated Code Contest, not the Most Readable Variable Names or the Longest Variable Name contest. The current behavior of I'm against this proposal. |
Beta Was this translation helpful? Give feedback.
-
|
Just a note: in C, identifiers can also be used as data: #include <stdio.h>
#define D(d) #d
int main() {
char *str = D(this_long_identifier_can_be_used_as_a_data);
puts(str); //=> this_long_identifier_can_be_used_as_a_data
return 0;
}A long identifier counting as 1 char leaves some room for creative abuse. Though the Gross Size Limit (4993 bytes) bounds how much data you can embed this way. (Personally, I prefer simpler rules, so the Net Size Limit feels unnecessarily complex to me.) |
Beta Was this translation helpful? Give feedback.
-
Because it IS shorter? It is not even just iocccsize: $ cat 1.c ; wc -c 1.c ; iocccsize -v 1 1.c ; cat 2.c ; wc -c 2.c ; iocccsize -v 1 2.c
int main() {
int a = "Hello World!";
printf("%s\n", a);
return 0;
}
74 1.c
41 74 3
int main() {
int hello_world = "Hello World!";
printf("%s\n", hello_world);
return 0;
}
94 2.c
61 94 3
Nobody is stopping anyone from using longer names in variables. It has been done before. For some good examples: ... and the size limit was more strict then. |
Beta Was this translation helpful? Give feedback.
-
|
We still do have the gross size limit of 4993 bytes, which this proposal doesn't question at all. That should be more than enough protection against To my understanding, the net size limit of 2503, as measured by My proposal is to do the same for variable and function names, such that it encourages that you provide a nicer shape not just by whitespace and comments, but also by choosing variable names (and especially their lengths) to make the code fit into a certain shape. Of course we could also use a logarithmic scale here, or add extra penalty for variable names longer than e.g. 8 characters. But I believe that the gross size limit is already enough protection against that. |
Beta Was this translation helpful? Give feedback.
-
|
There are many ways to create a "nicer shape", learn from others. Instead of thinking about how to solve the problem, you think about how to change the rules. Name length won't help here, because variables are also used in places other than the one they're defined in. Adding the name length in one place will also add the length in other places where the variable is used. |
Beta Was this translation helpful? Give feedback.
-
|
From https://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest on Rule 2 (I wrote that part):
The Net Size Rule was created to encourage formatted code vs square blob of code. |
Beta Was this translation helpful? Give feedback.
-
|
I made an argument for counting based on |
Beta Was this translation helpful? Give feedback.
-
Just to clarify: I am one of those winners (see 2019/diels-grabsch1). And in preparation of my winning (and non-winning) entries I did study tons of previous winners. And from exactly that experience I can say for sure that there is a very strong bias towards 1-char identifiers. You can see that in the past winners, you can feel this while coding yourself. Of course there are notable exceptions. But those are deliberate breakouts, and there's not much in between, except for entries with unicode identifiers, but even those have mostly 1-unicode-char identifiers. I for myself can say that I could have created much more interesting entries if So I started this discussion to see if others (especially other past winners) feel the same. But maybe that's indeed just me. And in this case, of course, it is correct to deny my proposal. |
Beta Was this translation helpful? Give feedback.
-
|
Some where in the one or two discussions or issues prior to IOCCC28 I had made a similar suggestion of capping long identifier counting at 4 bytes. This had no support, mind you, no one outside of the Judges, @xexyl, and I were publicly talking about. I think we first need support for counting by characters, not bytes, before Rule 2b could be retired. Or as I suggested elsewhere above, retire 2b and lower 2a as a counter balance. Pity this discussion was not raised before or during the contest, when the Judges could provide commentary; right now we'll have to wait till after Judgement Day (most likely). |
Beta Was this translation helpful? Give feedback.
-
|
I do find the qualitative discussion interesting, and I would like to add some numbers, so I made a spreadsheet:
|
Beta Was this translation helpful? Give feedback.
-
|
.. and regardless of what my thoughts are, I want you to know @vog, that I do appreciate your thoughts and I hope that I did not sound too dismissive. I have been awake too long and my sleep is totally upside down which does not help. Not that that would be an excuse if it did sound dismissive but it might help explain some of it (but I hope it didn't come across that way obviously). I PERSONALLY do think that smaller size (that is the way it is now) is more interesting because it is more of a challenge and I also don't see how your points are necessarily strictly correct (as in we don't need more bytes for formatting and other things) but that does not mean your view is wrong any more than my view is right (or not) because it's just your view and my view and everyone else who commented, it's their view also. |
Beta Was this translation helpful? Give feedback.
-
|
BTW for those who do not know or don't recall, the History Of Sizes (sounds like a Harry Potter spell book) is worth looking at. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the length of identifiers (variable names, function names) counts heavily towards to overall size of the program. Is there a specific reason for that?
The downside is that this is pushing entries heavily towards using 1-char identifiers - either to stay within the iocccsize limit, or to have one's entry be assigned to a lower size category.
But why should a program like this:
be considered shorter that that one:
?
Beta Was this translation helpful? Give feedback.
All reactions