User loginNavigation |
archivesProposed extension to C - array size declarationsSomewhat to my surprise, I may have found a politically acceptable way to extend C in a way that leads to the prevention of buffer overflows. Many people have struggled with this, but the previous attempts led to incompatibility, excessive overhead, or a new language. It turns out that combining C fixed size arrays, C++ references, and C99 variable-length automatic arrays seems to lead to a workable solution. An example is declaring the UNIX read call in this way: Present C form of declaration: There's more, of course; see the draft paper: "Safe Arrays and Pointers for C" (PDF) Now I need to find out if someone can find a flaw in this, so it needs to go before a qualified critical audience. So I'd like to see what the LtU crowd has to say about this. Thanks. Overloading by return type without typesI wonder if there are any strategies for overloading by a type of a return value in dynamically types languages. There is one example I am aware about - Perl and its "contexts". May be there are some other insights on this topic? Basically I mean run-time dispatch on the return values so that the code like so: //This function is overloaded for int32 maxValue _ = 0x7fffffff x = maxValue 0 can be translated into //Overloaded (polymorphic) constant maxValue = 0x7fffffff x = maxValue ::: Int without the need to statically type the program. |
Browse archivesActive forum topics |
Recent comments
36 weeks 2 days ago
36 weeks 2 days ago
36 weeks 2 days ago
1 year 6 weeks ago
1 year 10 weeks ago
1 year 12 weeks ago
1 year 12 weeks ago
1 year 14 weeks ago
1 year 19 weeks ago
1 year 19 weeks ago