Re: Difference between variables and functions
From: Eric Sosman (eric.sosman_at_sun.com)
Date: 08/29/05
- Next message: Anton Petrusevich: "Re: connect..."
- Previous message: Henry Law: "Re: Writing portable applications (Was: Jargons of Info Tech industry)"
- In reply to: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Next in thread: Brian Raiter: "Re: Difference between variables and functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Aug 2005 11:12:40 -0400
Ulrich Hobelmann wrote:
> Erik Max Francis wrote:
>
>>It's obvious to _you_ what he meant, because understood his intent and
>>could tell from the code sample that he meant to call the function named
>>read. But the compiler cannot do this, and so it shouldn't try, since
>>if it did it would make mistakes and confuse the programmer even
>>further.
>
>
> I agree there.
>
>
>>What if it wasn't a name conflict caused by a misunderstanding
>>of how the language worked, but rather a typo? In that case, second
>>guessing what the programmer meant and calling the function would be
>>exactly the _wrong_ thing to do.
>
>
> But he's calling a variable, so IMHO C should compile an indirect
> function call there.
Some other language, perhaps, but not C. Attempting
to call an `int' (or a `double' or a `struct gizmo') is a
constraint violation:
6.5.2.2 Function calls
Constraints
1 The expression that denotes the called function
shall have type pointer to function [...]
A diagnostic is required (5.1.1.3).
-- Eric.Sosman@sun.com
- Next message: Anton Petrusevich: "Re: connect..."
- Previous message: Henry Law: "Re: Writing portable applications (Was: Jargons of Info Tech industry)"
- In reply to: Ulrich Hobelmann: "Re: Difference between variables and functions"
- Next in thread: Brian Raiter: "Re: Difference between variables and functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|