Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #65801

Re: Error messages

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Error messages
Date 2015-07-17 14:43 -0400
Organization Self
Message-ID <55A94CDB.50900@verizon.net> (permalink)
References (6 earlier) <mob266$rd0$1@dont-email.me> <mob352$us8$1@dont-email.me> <55A92CAB.3000203@verizon.net> <mobgrv$ind$1@dont-email.me> <55A9496A.5050304@verizon.net>

Show all headers | View raw


On 07/17/2015 02:28 PM, James Kuyper wrote:
> On 07/17/2015 02:19 PM, Martin Shobe wrote:
>> On 7/17/2015 11:26 AM, James Kuyper wrote:
>>> On 07/17/2015 10:24 AM, Martin Shobe wrote:
>>>> On 7/17/2015 9:08 AM, jacobnavia wrote:
>>>>> Le 17/07/2015 15:50, Martin Shobe a écrit :
>>>>>>>
>>>>>>> Apparently gcc does it for C, but for C++ it is not possible.
>>>>>>
>>>>>> The example he gave for gcc "doing it" was for C++.
>>
>>>>> No. It just gave a "parse error", not a meaningful message like in C.
>>>>
>>>> Pay attention. The error message for C++ was the one below. It's the
>>>> same message as the C one, differing only by the file name.
>>>>
>>>> foo.cpp: In function 'int main()':
>>>> foo.cpp:3:3: error: 'TYPE' was not declared in this scope
>>>>      TYPE t;
>>>>      ^
>>>
>>> You're the one not paying attention.
>>
>> I'm aware of the original error message. However, Jacob used gwowen's 
>> examples as evidence that gcc did produce the type of error messages for 
>> C code that was "impossible" to produce for C++. Clearly he missed the 
>> fact that gwowen also showed C++ code where gcc produced the 
>> "impossible" error message.
> 
> I assume that jacob thought, as I did, that gowen's example wasn't
> necessarily relevant. His example involved a declaration of an object
> with an undeclared type name. The original example involved a call to an
> undeclared function template. That an useful error message was printed
> for gowen's example doesn't prove that the useless message printed for
> the original example had been fixed.

Note, in particular, that the "parse error" was reported as having
occurred somewhere before the '>' character in the following line:

	*buf= std::get_temporary_buffer<type>(size);

I know little enough about typical compiler internals, but I would have
expected that, immediately after reading the '<' character, the parser
would have recognized that get_temporary_buffer was an identifier, and
that it would then search it's symbol tables for
std::get_temporary_buffer. Upon failing to find it, I'd expect an error
message reporting that fact. I don't understand why it waited until
after having read the '>' character to report an error, and in
particular, to report one not obviously connected to the fact that
std::get_temporary_buffer has not yet been declared.
It's fairly obvious what it actually did: it's trying to parse
std::get_temporary_buffer<type as a comparison expression, and when it
reaches the '>' character, it realizes that 'type' isn't something that
can participate in a comparison expression. But that doesn't explain why
it didn't first identify std::get_temporary_buffer as something that
also couldn't appear in a comparison expression.

Parsing "TYPE t;" when TYPE has not been declared is a very different
context.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 02:36 +0200
  Re: Error messages Richard Heathfield <rjh@cpax.org.uk> - 2015-07-17 01:51 +0100
    Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-16 18:24 -0700
      Re: Error messages Lőrinczy Zsigmond <nospam@for.me> - 2015-07-17 09:31 +0200
        Re: Error messages Richard Heathfield <rjh@cpax.org.uk> - 2015-07-17 08:35 +0100
          Re: Error messages glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-17 09:11 +0000
            Re: Error messages Richard Heathfield <rjh@cpax.org.uk> - 2015-07-17 10:30 +0100
            Re: Error messages Ian Collins <ian-news@hotmail.com> - 2015-07-17 21:44 +1200
              Re: Error messages Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-17 12:55 +0100
              Re: Error messages Melzzzzz <mel@zzzzz.com> - 2015-07-17 19:53 +0200
              Re: Error messages glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-17 17:55 +0000
                Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-17 14:19 -0400
            Re: Error messages raltbos@xs4all.nl (Richard Bos) - 2015-07-19 21:44 +0000
        Re: Error messages gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-17 07:38 +0000
          Re: Error messages Noob <root@127.0.0.1> - 2015-07-17 09:58 +0200
            Re: Error messages gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-17 13:32 +0000
      Re: Error messages Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-18 11:13 +0100
  Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-16 22:36 -0400
  Re: Error messages Reinhardt Behm <rbehm@hushmail.com> - 2015-07-17 13:05 +0800
    Re: Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 09:48 +0200
      Re: Error messages David Kleinecke <dkleinecke@gmail.com> - 2015-07-17 19:23 -0700
        Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-17 21:24 -0700
          Re: Error messages David Kleinecke <dkleinecke@gmail.com> - 2015-07-18 18:29 -0700
            Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-18 20:59 -0700
              Re: Error messages David Kleinecke <dkleinecke@gmail.com> - 2015-07-19 19:22 -0700
            Re: Error messages David Brown <david.brown@hesbynett.no> - 2015-07-21 11:40 +0200
              Compiler conformance (Was: Error messages) gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-21 11:40 +0000
                Re: Compiler conformance Noob <root@127.0.0.1> - 2015-07-21 14:01 +0200
                Re: Compiler conformance gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-21 13:47 +0000
        Re: Error messages Reinhardt Behm <rbehm@hushmail.com> - 2015-07-18 13:38 +0800
    Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-17 07:54 -0700
      Re: Error messages raltbos@xs4all.nl (Richard Bos) - 2015-07-19 22:00 +0000
        Re: Error messages Richard Damon <Richard@Damon-Family.org> - 2015-07-19 19:47 -0400
  Re: Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 10:06 +0200
  Re: Error messages Bartc <bc@freeuk.com> - 2015-07-17 12:07 +0100
  Re: Error messages Noob <root@127.0.0.1> - 2015-07-17 13:14 +0200
    Re: Error messages Bartc <bc@freeuk.com> - 2015-07-17 12:40 +0100
  Re: Error messages gwowen <gwowen@gmail.com> - 2015-07-17 04:32 -0700
    Re: Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 14:15 +0200
      Re: Error messages gwowen <gwowen@gmail.com> - 2015-07-17 05:25 -0700
        Re: Error messages Bartc <bc@freeuk.com> - 2015-07-17 13:34 +0100
          Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-17 08:07 -0700
        Re: Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 14:38 +0200
          Re: Error messages Martin Shobe <martin.shobe@yahoo.com> - 2015-07-17 08:50 -0500
            Re: Error messages jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-17 16:08 +0200
              Re: Error messages Martin Shobe <martin.shobe@yahoo.com> - 2015-07-17 09:24 -0500
                Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-17 12:26 -0400
                Re: Error messages Martin Shobe <martin.shobe@yahoo.com> - 2015-07-17 13:19 -0500
                Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-17 14:28 -0400
                Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-17 14:43 -0400
                Re: Error messages Bartc <bc@freeuk.com> - 2015-07-17 20:31 +0100
                Re: Error messages Martin Shobe <martin.shobe@yahoo.com> - 2015-07-18 08:41 -0500
                Re: Error messages David Brown <david.brown@hesbynett.no> - 2015-07-21 12:25 +0200
                Re: Error messages James Kuyper <jameskuyper@verizon.net> - 2015-07-21 13:20 -0400
                Re: Error messages David Brown <david.brown@hesbynett.no> - 2015-07-22 00:05 +0200
          Re: Error messages Noob <root@127.0.0.1> - 2015-07-17 16:16 +0200
            Re: Error messages doctor@doctor.nl2k.ab.ca (The Doctor) - 2015-07-17 14:49 +0000
              Re: Error messages Noob <root@127.0.0.1> - 2015-07-17 20:02 +0200
                Re: Error messages The Doctor <doctor@doctor.nl2k.ab.ca> - 2015-07-17 22:24 +0000
                Re: Error messages Noob <root@127.0.0.1> - 2015-07-20 10:46 +0200
                Re: Error messages doctor@doctor.nl2k.ab.ca (The Doctor) - 2015-07-20 14:59 +0000
          Re: Error messages Keith Thompson <kst-u@mib.org> - 2015-07-17 08:25 -0700
      Re: Error messages raltbos@xs4all.nl (Richard Bos) - 2015-07-19 22:07 +0000
  Re: Error messages Ed Prochak <edprochak@gmail.com> - 2015-07-17 20:11 -0700

csiph-web