At the risk of being flamed for even thinking of posting on this
entertaining thread, I use Int16, UInt16 rather than int when I want to
control how many bits I'm using.  Otherwise it will be up to which compiler
you are using.  If you are writing code to be ultimately portable, then this
would not be the right way to go (since all compilers know what "int"
means).  But, since my Palm code is only going to be used on the Palm, I am
ignoring the "best practices" technique in favor of the "do exactly what I
say" technique.

paul

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of bill
Sent: Sunday, May 26, 2002 5:55 PM
To: Palm Developer Forum
Subject: Re: passing char* data[10] question Code sample


Hi again, thanx again, you guys have inadvertantly answered another question
I was pondering.  At any rate, I thought that the gcc compiler uses the
standard c/c++ codes plus the palms, 'strlen()' is found in any c/c++
publication, it's in all of mine so I didn't think there would be any
question of where that came from.
Something else I noticed: 'UInt16' and 'int' is there any differance in
these two, I thought there was?   And I believe this is a palm forum
question because programing the palm is the only place I have seen it.  If
there isn't a difference, why not just use 'int'??
thanx
bill

----- Original Message -----
From: "Joe Malone" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Sunday, May 26, 2002 4:40 PM
Subject: Re: passing char* data[10] question Code sample


> --- Keith Rollin <[EMAIL PROTECTED]> wrote:
> > I think that the questionable parts of what you said would
> > be the parts John pointed out.  strlen can be used just
> > fine on the Palm (with development environment support, or
> > with one's own macros),
>
> All I said about strlen is "There is no strlen() function in the Palm
> API".  I never said "you can't add strlen()."   But if someone has
> added a strlen() function, there is no way to determine what it is or
> how it works from the code he posts.
>
> > there's little wrong with using "char*" instead of "Char*".
>
> True, at the moment Char is a typedef for char (at least with CW).
> However, I didn't say there was anything wrong with it.  I said that
> because of his use of strlen() and char, I wondered if what he posted
> was actually from a Palm OS app, or was it something else.  It would
> not have been the first time that this has happened on this forum.  In
> this case, I was wrong.  But I don't think there was anything wrong
> with saying "this is what I suspect" when giving an answer.  Obviously,
> if the suspicion is wrong, the poster can either clarify, or he can
> just ignore the advice that follows the incorrect assumption.
>
> > Let's also take a look at the following that you posted:
> >
> > >   // locate a space
> > >   p = StrChr(sentence, ' ');
> > >
> > >   if (p)
> > >     // found a space, so copy the word
> > >     StrNCopy(word, sentence, (p - sentence));
> >
> > This is questionable, not only because StrNCopy's definition has
> > changed in practically every release of the OS, but because even when
> > using the standard definition of strncpy, you'll have a termination
> > problem.  You are guaranteeing that the result will not be properly
> > terminated with a NUL.
>
> As you guessed, that was just something I typed in and I forgot to put
> in the terminating 0 and I failed to say it was just
> off-the-top-of-my-head code.  Didn't I already say it was late when I
> wrote that?
>
> BTW, the statement "That's the end of today's lesson on the C
> programming language" was meant as sarcasm.  I guess I should have
> inserted a bunch of smileys, but then the anti-smiley group would
> complain about that!
>
> - Joe "Though nobody questions Madonna (Ciccone), by popular demand,
> here is a surname:" Malone
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>



--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to