From: Robert Eachus <rieachus@comcast.net>
Subject: Re: no + or - defined for fixed point types in Standard, why ?
Date: Wed, 24 Jan 2018 19:07:08 -0800 (PST)
Date: 2018-01-24T19:07:08-08:00 [thread overview]
Message-ID: <43bc9f67-1a10-42c6-b04d-79a7731408b4@googlegroups.com> (raw)
In-Reply-To: <13db4b37-ac2d-497d-b7eb-f2d93462f480@googlegroups.com>
On Wednesday, January 24, 2018 at 8:31:33 PM UTC-5, guyclaud...@gmail.com wrote:
> > As I said, you can turn off warnings if it bothers you. I think if you look through the GNAT sources, there are a number of places where they do that. As a programming practice, I like it. It says that the programmer knows that the compiler won't like this, but I want to do it anyway.
>
> I wouldn't have thought reading that from an Ada user 0_0
> I don't think I'm nearly as wise as people who wrote the compiler. Even if I had been a qualifier programmer, I would think the same and abide by the conventions as much as I could. I'm too conservative in general to go against habits without due reasons or ways to do otherwise.
>
> > function Test is
> > begin if false then return; end if; end Test;
> >
>
> it says the first line lacks a "return" statement, which even I can see... why writing such a thing ? Looks like a piece of C, with its void function, or whatever they call that. It's raising hairs on my shoulder, really.
function Test return Integer is
begin if false then return 6; end if; end Test;
Oops! wrong test case, try this:
function Test3 return Integer is
begin if false then return 6; end if; end Test3;
You should get at least one warning, and no errors. Provide a Boolean parameter instead of false:
function Test4 (X: Boolean) return Integer is
begin if X then return 6; end if; end Test4;
And you should be down to one warning.
Compiler writers have thousands of these ugly things and sometimes what the compiler guesses you intended is good for a laugh. Some test cases are regression tests collected from bug reports--you never want to reintroduce an old bug. Others are designed to thoroughly test all the ways you imagine that a new feature can get misused.
next prev parent reply other threads:[~2018-01-25 3:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 17:03 no + or - defined for fixed point types in Standard, why ? Mehdi Saada
2018-01-24 17:44 ` Robert Eachus
2018-01-24 18:36 ` Mehdi Saada
2018-01-25 1:09 ` Robert Eachus
2018-01-25 1:31 ` guyclaude.burger
2018-01-25 3:07 ` Robert Eachus [this message]
2018-01-25 3:25 ` Randy Brukardt
2018-01-25 13:33 ` Mehdi Saada
2018-01-26 4:34 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox