Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What do you think about a C++ educational compiler?

2 views
Skip to first unread message

DeMarcus

unread,
Aug 22, 2010, 9:05:37 PM8/22/10
to
Hi,

(Many of you may find this off topic, but I consider it being of C++
educational value.)

What would you think of having your compiler not just give you an error
message, but also tell you what paragraph in the standard you broke?


Regards,
Daniel

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jerry Stuckle

unread,
Aug 22, 2010, 10:26:06 PM8/22/10
to
On 8/22/2010 9:05 PM, DeMarcus wrote:
> Hi,
>
> (Many of you may find this off topic, but I consider it being of C++
> educational value.)
>
> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?
>
>
> Regards,
> Daniel
>

I'm not sure what advantage this would have. I think very few people
have copies of the standard. I think it would just be more confusing to
a lot of people. And what do you do if it violates multiple paragraphs
(as a lot of syntax errors do)?

I also think it would be a large cost for the compiler developers to
implement such a feature.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Öö Tiib

unread,
Aug 23, 2010, 4:21:04 AM8/23/10
to
On 23 aug, 04:05, DeMarcus <use_my_alias_h...@hotmail.com> wrote:
> Hi,
>
> (Many of you may find this off topic, but I consider it being of C++
> educational value.)
>
> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?

Interesting idea. Diagnostics of compilers are usually documented
somewhere so you may take the list and try to match it with standard.

There are likely problems however. Compiler vendors are already
putting lot of effort into making the diagnostics as helpful they can.

It is difficult since compiler is just a program and it has limits.
For example compiler tells that it did not expect ';' at that spot or
that it found a name that is unspecified for it. It rarely can tell
what exactly you did likely want to do so it does not know what you
did violate.

Such a teaching compiler however should instead understand what you
did try to do. It is often hard even for other human being without
asking from the author of non-compiling code.

Joshua Maurice

unread,
Aug 23, 2010, 4:21:59 AM8/23/10
to
On Aug 22, 6:05 pm, DeMarcus <use_my_alias_h...@hotmail.com> wrote:
> Hi,
>
> (Many of you may find this off topic, but I consider it being of C++
> educational value.)
>
> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?

It would be very nice if the standard was intelligible. As is, it
would be of some minor use, but as I've said in other threads: C++
programmers program more to accept practice and known implementations
than they do to the often vague, unclear, poorly organized official
standard.

As is, I much prefer error messages which say "Did not expect <x>.
<blah blah blah>. Did you mean for the dependent name to be a type?
Try using "typename"." which some modern compilers will do.

Frank Buss

unread,
Aug 23, 2010, 4:21:07 AM8/23/10
to
DeMarcus wrote:

> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?

This would be a good idea. And I would like to have a C++ compiler, which
would detect all undefined behavior locations in my code, too :-)

--
Frank Buss, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de

nm...@cam.ac.uk

unread,
Aug 23, 2010, 1:56:20 PM8/23/10
to
In article <8da632bc-2691-4522...@x20g2000pro.googlegroups.com>,

Joshua Maurice <joshua...@gmail.com> wrote:
>On Aug 22, 6:05 pm, DeMarcus <use_my_alias_h...@hotmail.com> wrote:
>>
>> (Many of you may find this off topic, but I consider it being of C++
>> educational value.)
>>
>> What would you think of having your compiler not just give you an error
>> message, but also tell you what paragraph in the standard you broke?

Infeasible. Firstly, each version of the standard differs, sometimes
drastically. Secondly, many errors don't correspond to any single
location in the standard, and sometimes even correspond to no location
at all (i.e. using a syntactic form that does not exist).

>It would be very nice if the standard was intelligible. As is, it
>would be of some minor use, but as I've said in other threads: C++
>programmers program more to accept practice and known implementations
>than they do to the often vague, unclear, poorly organized official
>standard.

Look on the bright side - it's better than many. A standard should
favour precision over readability, but I agree that it isn't as good
on the former as it should be.

>As is, I much prefer error messages which say "Did not expect <x>.
><blah blah blah>. Did you mean for the dependent name to be a type?
>Try using "typename"." which some modern compilers will do.

Yeah. Fine when you make an obvious, common error. When you make
a more subtle one, you have to reverse engineer the message to find
out what it is objecting to.


Regards,
Nick Maclaren.

Johannes Schaub (litb)

unread,
Aug 23, 2010, 1:58:52 PM8/23/10
to
DeMarcus wrote:

> Hi,
>
> (Many of you may find this off topic, but I consider it being of C++
> educational value.)
>
> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?
>

Many compilers already do that. They give error codes.

Ian Collins

unread,
Aug 23, 2010, 1:55:38 PM8/23/10
to
On 08/23/10 01:05 PM, DeMarcus wrote:
> Hi,
>
> (Many of you may find this off topic, but I consider it being of C++
> educational value.)
>
> What would you think of having your compiler not just give you an error
> message, but also tell you what paragraph in the standard you broke?

That's probably something best left to the tools that are used with the
compiler, such as an IDE. Some diagnostics are verbose enough now
without adding to them.

--
Ian Collins

Daniel Pitts

unread,
Aug 23, 2010, 7:54:20 PM8/23/10
to
On 8/22/2010 7:26 PM, Jerry Stuckle wrote:
> On 8/22/2010 9:05 PM, DeMarcus wrote:
>> Hi,
>>
>> (Many of you may find this off topic, but I consider it being of C++
>> educational value.)
>>
>> What would you think of having your compiler not just give you an error
>> message, but also tell you what paragraph in the standard you broke?
>>
>>
>> Regards,
>> Daniel
>>
>
> I'm not sure what advantage this would have. I think very few people
> have copies of the standard. I think it would just be more confusing to
> a lot of people. And what do you do if it violates multiple paragraphs
> (as a lot of syntax errors do)?
>
> I also think it would be a large cost for the compiler developers to
> implement such a feature.
>
Not to mention, a syntax error might be the fact that it *doesn't* match
a section of the standard. You can usually say why a parse was
successful, but knowing exactly why it was not is often difficult.

When I was more naive (not that I'm not still naive), I used to wonder
"If it knows I'm missing a semicolon, why doesn't it just add it for
me?" :-)

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

Daniel Pitts

unread,
Aug 24, 2010, 12:00:36 AM8/24/10
to
On 8/23/2010 1:21 AM, Frank Buss wrote:
> DeMarcus wrote:
>
>> What would you think of having your compiler not just give you an error
>> message, but also tell you what paragraph in the standard you broke?
>
> This would be a good idea. And I would like to have a C++ compiler, which
> would detect all undefined behavior locations in my code, too :-)
>
Agreed. Detectable undefined behavior should be an error. It becomes
more difficult if the undefined behavior cannot be determined statically
in a reasonable time, however.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

[ See http://www.gotw.ca/resources/clcm.htm for info about ]

Daniel

unread,
Aug 24, 2010, 2:09:17 AM8/24/10
to
On Aug 23, 7:54 pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:

> When I was more naive (not that I'm not still naive), I used to wonder
> "If it knows I'm missing a semicolon, why doesn't it just add it for
> me?" :-)
>

Back in the mid eighties, I used a DEC VAX C ompiler that tried to fix
up errors at compile time, it would insert a closing brace somewhere,
if it found one missing. It never seemed to insert it in the right
place, though. I started looking at warning messages really
carefully.

-- Daniel


--

nm...@cam.ac.uk

unread,
Aug 24, 2010, 4:56:28 PM8/24/10
to
In article <8aa4351f-97a6-4648...@k10g2000yqa.googlegroups.com>,

Daniel <daniel...@gmail.com> wrote:
>On Aug 23, 7:54 pm, Daniel Pitts
><newsgroup.spamfil...@virtualinfinity.net> wrote:
>
>> When I was more naive (not that I'm not still naive), I used to wonder
>> "If it knows I'm missing a semicolon, why doesn't it just add it for
>> me?" :-)
>
>Back in the mid eighties, I used a DEC VAX C ompiler that tried to fix
>up errors at compile time, it would insert a closing brace somewhere,
>if it found one missing. It never seemed to insert it in the right
>place, though. I started looking at warning messages really
>carefully.

They still exist. Many "syntax-aware editors" have such a feature.
Semicolons are not too bad, as the fixup is usually either correct,
or leads to another error, but correcting bracketting (especially
curly ones in languages like C and C++) is a nightmare.


Regards,
Nick Maclaren.

osmium

unread,
Aug 24, 2010, 5:04:07 PM8/24/10
to
"Daniel" wrote:

> Back in the mid eighties, I used a DEC VAX C ompiler that tried to fix
> up errors at compile time, it would insert a closing brace somewhere,
> if it found one missing. It never seemed to insert it in the right
> place, though. I started looking at warning messages really
> carefully.

That makes me think of COBOL, which I studied, and wrote student programs for, but never actually used. One of the many things I hated about COBOL was the multiple spellings of allowed keywords for a single concept. A real example: ZERO, ZEROES, ZEROS,
choose the one that suits your mood today!

http://www.felgall.com/cob3.htm

WRT the C++ proposal in this thread, I think it is a Real Bad Idea.

0 new messages