I often change my mind (sometimes back and forth several times) about
whether a given variable should contain a pointer to a structure or
the structure itself, and generally each time I'll have to change
several instances of "." to "->" or vice versa, in the related code.
But the compiler knows when something is a pointer, why can't it let
me write "." in every case and automatically dereference as many times
as necessary?
I've read dmr's article on the history and development of C, and he
talks about a time when "foo->bar" would compile almost regardless of
the type of "foo", with "->bar" just meaning "add a certain offset and
dereference a value of a given type". (Does this mean it wasn't
possible to use the same member name in more than one structure type,
at least for members at different offsets?) Anyway, though, if it was
just a question of backwards compatibility at some point, they could
have deprecated "->" while adding new functionality to ".". So: Is
there a good reason that I'm missing, or is it just that somebody
thought it was a good idea for the programmer to have to make the
difference between pointers and values explicit on every reference?
Because it seems like syntactic salt to me. 3 1679 no**********@gmail.com wrote:
I often change my mind (sometimes back and forth several times) about
whether a given variable should contain a pointer to a structure or
the structure itself, and generally each time I'll have to change
several instances of "." to "->" or vice versa, in the related code.
But the compiler knows when something is a pointer, why can't it let
me write "." in every case and automatically dereference as many times
as necessary?
We just had a long thread on this, look it up.
Brian
On Jul 23, 2:19 am, "Default User" <defaultuse...@yahoo.comwrote:
not.here....@gmail.com wrote:
I often change my mind (sometimes back and forth several times) about
whether a given variable should contain a pointer to a structure or
the structure itself, and generally each time I'll have to change
several instances of "." to "->" or vice versa, in the related code.
But the compiler knows when something is a pointer, why can't it let
me write "." in every case and automatically dereference as many times
as necessary?
We just had a long thread on this, look it up.
Brian
I was puzzled when I saw this, because a short while ago I checked for
such, without success. But I looked again, and found the thread...
started by me. I thought Google Groups hadn't posted my message, but
in fact it was only delayed by a few hours. Apologies! no**********@gmail.com wrote, On 23/07/07 07:56:
<snip>
I was puzzled when I saw this, because a short while ago I checked for
such, without success. But I looked again, and found the thread...
started by me. I thought Google Groups hadn't posted my message, but
in fact it was only delayed by a few hours. Apologies!
With news groups you have to wait at least a day before assuming things
have gone wrong.
--
Flash Gordon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: steve |
last post by:
I am quite frustrated with php’s include, as I have spent a ton of
time on it already... anyone can tell me why it was designed like this
(or something I don’t get)?
The path in include is...
|
by: steve |
last post by:
Hi,
I need to do conditional script "include", but like to pull the code
from db instead of a file. How do I do that?
Reason: I like to implement some complex regex logic, and make it
table...
|
by: Matt |
last post by:
I have 2 questions:
1. strlen returns an unsigned (size_t) quantity. Why is an unsigned
value more approprate than a signed value? Why is unsighned value less
appropriate?
2. Would there...
|
by: James Curran |
last post by:
I'd like to make the following proposal for a new feature for the C#
language. I have no connection with the C# team at Microsoft. I'm posting
it here to gather input to refine it, in an "open...
|
by: comp.lang.php |
last post by:
$orderBy = 's.app_date desc, s.last_name asc, s.first_name asc, s.mi
asc';
if ($_REQUEST) {
$ascArray = array('asc' => 'desc', 'desc' => 'asc'); // ARRAY OF
ALL ORDERING POSSIBILITIES
$junk =...
|
by: Ulysse |
last post by:
Hello,
I need to clean the string like this :
string =
"""
bonne mentalité mec!:) \n <br>bon pour
info moi je suis un serial posteur arceleur dictateur ^^*
\n ...
|
by: Angus |
last post by:
I am trying to change the selection in Javascript - but this HTML element is
not a standard option control.
On the web page it looks like a dropdown list - and you click on the right
hand down...
|
by: Maria Sudderman |
last post by:
I have a prblem with the "onClick" command.
onClick="insert('<a href="URI">', '</a>')">
but this is not correct! why?
Maria
|
by: manchin2 |
last post by:
Hi,
Can anybody please provide the information about """ and its use, if possible please provide an example.
...
|
by: jmash |
last post by:
Suppose I have the following string whch is part of an xml string:
String s= "Script Id="Test" "
And I need to get
s= "Script Id="Test" "
Can anyone tell me how this can acheived?
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |