Thread View: gnu.g++.bug
2 messages
2 total messages
Started by Ron Guilmette
Sat, 22 Apr 1989 21:23
missed warnings in g++ 1.35.0 (pre-release)
Author: Ron Guilmette
Date: Sat, 22 Apr 1989 21:23
Date: Sat, 22 Apr 1989 21:23
11 lines
833 bytes
833 bytes
If you compile the following code with -Wall, you will only get one
warning to the effect that "structure has no members" this appears
to be inconnsistant because neither of the two have any members,
so there should be *two* warning messages.
-------------------------------------------------------------------
struct base { };
struct derived : public base { };
---------------------------------------------------------------------
Re: missed warnings in g++ 1.35.0 (pre-release)
Author: OVE EWERLID
Date: Sun, 23 Apr 1989 08:27
Date: Sun, 23 Apr 1989 08:27
69 lines
2608 bytes
2608 bytes
In article <8904222123.AA22649@riunite.aca.mcc.com>, rfg@MCC.COM (Ron Guilmette) writes:
> If you compile the following code with -Wall, you will only get one
> warning to the effect that "structure has no members" this appears
> to be inconnsistant because neither of the two have any members,
> so there should be *two* warning messages.
I agree that the warnings but also the error messages suffer from a
certain degree of inconnsistency. (Cosmetic though)
We also have:
foo (int a)
{
int a;
//......
}
We ought to get a warning that the argument
is being shadowed! (at least when the -Wall flag is given)
or is this valid C++?
also:
foo ()
{
a=b+b+b+b;
}
Don't know if this exact example suffers from the fact, that
although the error message states that b is to be reported only once
as undefined it is not. (Inconnsistent?)
As I haven't got access to g++ on this machine I can't state an
exact example. As I se this effect regularly it ought to be well known.
and:
foo()
{
double a;
int b;
b=a;
}
Here we get a warning. This is as it should be as the function is
ambigous as there exist many ways to map a float to an integer.
However, one should be able to specify what kind of mapping the
compiler uses. One could for instance have a flag that indicated
some handy mapping. If this flag is specified the compiler can
and should be silent as the mapping no longer is ambigous.
The two mappings that springs up is rounding and truncating.
There is a gain connected with the mapping method.
On a sun3 with FPU there exist two mappings in the FPU, each mapping
has its own instruction.
Now, if you need the method that isn't present(rounding) and
don't want to define a macro to do the job as this is inefficient
you gotta patch the assembler output. Simply replace the trunc
instruction with the desired rounding ditto.
In tight loops the gain can be huge.
(Ofcourse you can alter the specific line in md,
but it is still quite messy)
Nice if an abillity to choose method was embedded in the compiler!
As stated, the above is cosmetics at this stage of g++........
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads