Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Bounds checking by default.

Actors, more precisely active objects in Active Oberon, the only one still actively being developed at ETHZ from Oberon linage.



but that's a high level feature, when people talk about C not being a low level language they mean you can't control/reflect the hardware enough right ? or maybe I'm misguided


>> what do you think apl and oberon can express that C cannot ?

> Bounds checking by default.

That's odd - I've written a C container library that checks bounds by default.

Are you sure that C doesn't allow you to check bounds?


Absolutely unless you're using a compiler with language extensions for pointer management.

A library isn't the language that is described by the ISO C standard document.


> A library isn't the language that is described by the ISO C standard document.

Sure, but the poster didn't ask "what comes with apl and oberon that doesn't come with C", they asked "what do you think apl and oberon can express that C cannot?"

And you absolutely, positively can EXPRESS bounds checking in C. I'm not sure where you heard that this is impossible, but it's probable you misunderstood or that source is wrong.


First of all your library doesn't come with C, otherwise it would be defined on the PDF I can buy from ISO.

Secondly using if statements and conditional expressions isn't what bounds checking in a programing language is about.

Here is some education material,

https://en.wikipedia.org/wiki/Bounds_checking

> Many programming languages, such as C, never perform automatic bounds checking to raise speed. However, this leaves many off-by-one errors and buffer overflows uncaught. Many programmers believe these languages sacrifice too much for rapid execution.[1] In his 1980 Turing Award lecture, C. A. R. Hoare described his experience in the design of ALGOL 60, a language that included bounds checking, saying:

Feel free to update the Wikipedia page and convince Wikipedia of your reasoning.


What does any of that have to do with whether or not you can EXPRESS bounds checking in a C program?

You were misinformed; one can certainly express bounds checking in a C program, independent of libraries or compiler extensions.


Please educate us, we are all curious to learn how.

Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator.

As second exercise, show us how a function call using pointer + length, validates that the lengh into the pointer region is a valid length for the memory region total size.


> Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator.

Who said anything about arrays?

Let me refresh what was said, and what you claimed.

What was said:

> what do you think apl and oberon can express that C cannot ?

What you claimed

> Bounds checking by default.

Are you seriously saying that you did not claim that bounds checking cannot be expressed in C?

Because that is all this boils down to - my reading of that was that you claimed that bounds checking is an example of a thing that "apl and oberon can express that C cannot ? "

> Only the ISO C language is allowed, declare C array and then show us how do you validate the accesses with the index operator.

No one made this claim so there is no point in doing what you asked.

> As second exercise, show us how a function call using pointer + length, validates that the lengh into the pointer region is a valid length for the memory region total size.

No one claimed this either. The specific claim is that it is possible to express bounds checking in C.


Too many words and very little facts.

Care to provide your library for the security folks to have a go at your bounds checking implementation in C.


> Care to provide your library for the security folks to have a go at your bounds checking implementation in C.

Once again, I have to ask - what does that have to do with your claim that C is unable to express bounds checking?


slightly branching out, I wonder if recent languages like zig allow (or will) customized array language features. They seem to more flexible about compiletime vs runtime and also allocation mechanisms


Hmm good question, but i think my question is located half way. What you describe is basically turing completeness, C allow to write more on top, but it won't be integrated in the base constructs of the language. I admit that this comment too is fuzzy :)

I hope things don't go angry in here




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: