From: | Laura Vance |
Date: | 28 Aug 99 at 02:07:59 |
Subject: | Re: Re: ExecBase & 'RESET:starting PC' exception |
From: Laura Vance <vancel@amiga.nols.com>
On Sat, 28 Aug 1999 01:30:57 +0100,
Ben Hutchings <womble@zzumbouk.demon.co.uk> wrote about Re: [amiga-c] Re:
ExecBase & 'RESET:starting PC' exception:
>From: Ben Hutchings <womble@zzumbouk.demon.co.uk>
>
>On Sat, Aug 28, 1999 at 12:44:33AM +0100, Andrew Markwell wrote:
>> From: Andrew Markwell <andrewmarkwell@ukonline.co.uk>
>>
>> On 27-Aug-99 did write:
>> > From: Ben Hutchings <womble@zzumbouk.demon.co.uk>
>> >
>> > On Fri, Aug 27, 1999 at 12:42:39AM +0100, Andrew Markwell wrote:
>> >> From: Andrew Markwell <andrewmarkwell@ukonline.co.uk>
>> >>
>> >> On 27-Aug-99 did write:
>> >> From: Ben Hutchings <womble@zzumbouk.demon.co.uk>
>
><snip>
>> >>> You should use const char * here, not char *.
>> >>>
>> >> er, why?
>> >
>> > String literals are arrays of const char.
>> >
>> First I've heard of it.
>
>You doubt what I say? Perhaps you should find some decent documentation
>on standard C or C++.
>
>For hysterical raisins, you are allowed to assign string literals to
>objects of type char *. That's just a special case; it doesn't mean that
>they are really arrays of char.
>
I know that I'm sticking my nose in a conversation where it's not welcome,
but it seems to me that a char * is a pointer to the beginning of a null
terminated array of type char. Anything in double quotes can be of type
char * if it's probably going to change. In the C and C++ classes that
I've taken in college, they say to reserve the const char * for something
that will definately not change. And since we only saw a code fragment, we
do not know that other string literals will not be passed into the error
handling function.
just my 2�
Laura