[PATCH] D18172: [CUDA][OpenMP] Add a generic offload action builder
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 30 21:09:12 PDT 2016
ABataev added a comment.
In http://reviews.llvm.org/D18172#471861, @jlebar wrote:
> Alexey, it seems that you're asking for "final" on all classes that are not inherited from. Forgive my ignorance, but would you mind pointing me to the document that talks about our position on "final" in LLVM source? I don't see it in the style guide, but I may be missing something.
>
> The style guide does talk a good bit about writing concise and generally not-misleading code. My concern is that adding "final" everywhere paints an inaccurate picture and will mislead readers. Specifically, "final" is useful as a signal to readers that a class cannot safely be inherited from. "Don't even think about it, buster." But here we're adding "final" to a lot of classes that, as far as I can tell, aren't distinctive except in that they have no subclasses today. The problem with this is that, if we use "final" in this way, it dilutes the first "don't even try" meaning. Now when I see a class with "final" that I want to subclass, I'm just going to rip the "final" off, because chances are, I can do so safely. Now "final" does not serve as a warning to me that I shouldn't do this.
>
> Sorry to focus on a superficial issue, but I think this really does matter for usability.
Hi Justin,
There are no strict rules on using 'final'. But I believe that it is better to protect developers from unintended use of code and if language allows to do it we should do it. If some class is not intended to be used as a base class, it is better to mark it as 'final' to be sure that nobody will inherit from it for sure. Consider it as an additional contract of the class.
http://reviews.llvm.org/D18172
More information about the cfe-commits
mailing list