Simon,
Thanks for the response.  Two points:

1) The code is in the SQLite library, not my application. 

2) Surely if chars are signed by default in MSVC, then islower() should work 
with this default?

PS - I have never had a problem with this before...

Regards,
Steve

-----Original Message-----
From: Simon Middleton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 18, 2005 12:57 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Strange UPPER() behaviour

Drew, Stephen wrote:
> Hello,
> I was running my application which uses SQLite in debug mode, and I 
> noticed some very bizarre behaviour in this function:
>  
> The character in question was the pound sign ('£') whose value the 
> debugger said was -93 (the watch window however said 163).  It seems 
> that inside my implementation of islower, it does the following assertion:

Sounds like chars in your environment are signed by default. This means that 
any char that you expect to be between 128 and 255 reads as -128 to
-1 instead. This often doesn't matter if you are just writing the char back to 
memory but if you try and pass it to an OS routine like
toupper() or cast it to unsigned as you do then you'll get incorrect results.

Your choices are to either change your compile settings so that chars are 
unsigned by default (probably safest) or to change your code to explicitly use 
unsigned chars, declare z as 'unsigned char *z'.

Hope this helps.

-- 

Simon Middleton, Senior Software Engineer

ANT Limited, Cambridge Business Park, Cowley Road, Cambridge CB4 0WZ, UK Tel 
+44 (0)1223 716413 Switch +44 (0)1223 716400  Fax +44 (0)1223 716401
<[EMAIL PROTECTED]>               http://www.antlimited.com

TI integrates ANT Galio for advanced digital TV applications 
www.antlimited.com/news/2005-01-05-ti-ces.htm

* ANT LIMITED LEGAL DISCLAIMER *
This message (which includes any files transmitted with it) is confidential and 
contains information which may be legally privileged. It is intended for the 
stated addressee(s) only.
Access to this email by anyone else is unauthorised. If you are not the 
intended addressee, any disclosure, copying or storage of the contents of this 
email, or any action taken (or not taken) in reliance on it, is unauthorised 
and is unlawful.
If you are not the addressee, please delete the original and any copies and 
inform the sender immediately.

Reply via email to