>When is the closing date for the competition?
When everyone that signed up before today submits. But you don't have to be signed up to submit an entry.
Printable View
>When is the closing date for the competition?
When everyone that signed up before today submits. But you don't have to be signed up to submit an entry.
You think so? Really?Quote:
Originally Posted by Prelude
You mean to say it's simple string parsing for it to work with the results of something on the IOCCC which conformed to the standard? The above was just a quick example, but I'm sure there's way worse that would break it.Code:int main( void )
{
int x[BUFSIZ];
printf("%[10]",(3+1-7*4/11+200)[x]));
return 0;
}
Actually, I'd really like to see it done:
Now with pure text subsitution, show me that all of those are in bounds at all times.Code:#include <stdio.h>
#define W 1000
int main( void )
{
int x = 0, y = , z[W];
for(x=0,y=W;x<W;x++,y--)
printf("%d",(z[z[w-x+y]])[z]);
return 0;
}
Quzah.
>You mean to say it's simple string parsing for it to work with the results of something on the IOCCC which conformed to the standard?
You're referring to the intermediate task. But technically it's still textual substitution, even if the process of setting it up is more difficult. And for the sake of the contest I don't require the commutativity of subscripting to be taken into account, though if a solution does it then it would likely be good enough to win. ;)
>Now with pure text subsitution, show me that all of those are in bounds at all times.
Well, that example would fail to compile, but assuming it was written in haste, the principle is the same. It's far from simple, but still text replacement.
You can also have macro, string names, function calls in combination with [ ].Quote:
Originally Posted by Prelude
Quzah.
>You can also have macro, string names, function calls in combination with [ ].
So you're saying that it's impossible? ;)
Yeah. Pretty much. Unless you have a program with no user input at all, it'd be impossible to know for sure that functions which return a value which is used to index an array would return a value in range. You could always FORCE a fit, by wrapping a modulus of the array size around it some how, but I still think you couldn't do it due to the complexity of potential array name, brackets, value ordering.
[edit]You'd have to actually have a program with no input whatsoever, and it couldn't use any random values, and all poniters would of course have to be initialized, as well as variables before using them, otherwise you could pull that "unknown" value... ;)[/edit]
[edit2]
Actually...
You might be able to do it if you wrote a program that would replace all [ ] chunks of code which would replace all operatins on arrays with function calls, and it would instead of being an actual array, be a dynamicly allocated chunk of memory which the only operations done on it were by said "operator overloading" functions.
But if you're doing that, you may as well just write your own damn language...
[/edit2]
Quzah.
I disagree. This isn't a syntactic checker and it certainly isn't expected to do it at compile-time. The idea is to replace the subscript with a suitable assertion that will halt the program with a debug statement before there's any undefined behavior. Using a table of existing arrays and sizes, the parser should be able to tell what is an array subscript and what isn't (a simulated array with pointers isn't, btw). Because the index would be used more than once in the replacement text, a global variable for saving it can be defined by the preprocessor.
In light of all that, it's not as impossible as you suggest, especially since I don't require a one pass algorithm. ;) The hardest part is the parsing, and as I already said, I don't expect entries to be complete in that they handle every legal construct, just the most common/reasonable ones.
Then they'd be incomplete, and not a full working extension. If they can't parse the example I've given, and anything like it, then they can't be considered a full working extension.Quote:
I don't expect entries to be complete in that they handle every legal construct, just the most common/reasonable ones.
In otherwords, I bet I can break any "working" end result, using full ANSI compliant, no-warnings, no-errors, -pedantic code to do so.Code:char array[SIZE];
0[array+functioncall()]=functioncall()[array];
Quzah.
>Then they'd be incomplete, and not a full working extension.
If you disapprove so much, you aren't forced to participlate. ;)
It's your contest. I'm just surprised you'd consider a non-working example working. Have fun.
Quzah.
>I'm just surprised you'd consider a non-working example working.
Well, you have to consider that I spent all of 15 seconds devising all three of them. The result is usually a task that's much harder than it seems originally because I think of things that I would find interesting and I have to scale it back to make it doable for the level of people who enter. You'll notice that the talented programmers like you and Salem don't regularly participate. ;)
How about an implementation that simply inserts:
around all array indexing. ;)Code:(()%size)
Quzah.