Am 12.07.2012 um 02:58 schrieb John McCall:

> Subscripting on objects has an existing meaning in fragile runtimes:  it's 
> pointer arithmetic.  Is that meaning useful?  Well, possibly not, but 
> nonetheless such code has historically been valid.

As such code does not exist for ObjFW as there is not that historical part, I'd 
like to just forbid pointer arithmetics and allow subscripts.

> Now, technically that only applies to subscripts of integral type;  
> subscripts of pointer type are ill-formed, so we could have given them the 
> new behavior and left the integral case as pointer arithmetic.  We felt that 
> that would add a lot of confusion for little gain, and I think that's still 
> true for objfw.

Not quite sure how this will add confusion?

> IIRC, you were considering making objfw use the non-fragile runtime.

Yes, but only optionally, due to the performance impact. The idea would be to 
be compatible with both and being able to chose per file.

> In that case, you might want to proactively forbid pointer arithmetic.

Yes, that sounds sane.

> I'd be fine with you adding a new predicate (allowsPointerArithmetic()) on 
> ObjCRuntime for this, if you then change Sema to use it in all the 
> appropriate places.  (You seem to have a good feel for how to do this.)  You 
> should also add another predicate (isSubscriptPointerArithmetic()), with the 
> invariant that it's only true if allowsPointerArithmetic() is, which Sema 
> would use to decide how to interpret subscripting on ObjC pointers.

Will do that, thanks.

> I'd prefer that that be a separate patch, anyway.  The rest of your patch 
> looks fine to me, so if you wouldn't mind preparing a patch without the 
> subscript changes, I'd be happy to commit that for you.

Removed the last two hunks from the patch and attached it again (just lazily 
removed them with an editor).

Thanks a lot!

Attachment: objfw-runtime.patch
Description: Binary data

--
Jonathan
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to