|
![](/i/fill.gif) |
On 18/04/2012 12:13 PM, Warp wrote:
> Invisible<voi### [at] dev null> wrote:
>>> It can be argued using the same logic as with uninitialized variables,
>>> though: There are situations where execution never reaches the end of the
>>> function, and hence having a 'return' statement there would be useless.
>
>> Sure. But like I said, the Java compiler seems to detect this.
>
> But the C++ compiler cannot break the standard by making the situation
> an error. It can only issue a warning.
Sure. I understand that. The problem is that the standard requires this
to be permissible. I was just pointing out that "because it's impossible
to detect" is not a valid reason for the standard being written this
way. (Backwards compatibility is, of course.)
> (And besides, any kind of detection of this cannot be 100% accurate,
> as the problem "will this line of code ever be reached?" is unsolvable
> in the general case.)
Sure.
Post a reply to this message
|
![](/i/fill.gif) |