Re: <ctype.h> toLower()

From: Richard Heathfield (dontmail_at_address.co.uk.invalid)
Date: 12/05/03


Date: Fri, 5 Dec 2003 18:39:29 +0000 (UTC)

Jumbo wrote:
> "Richard Heathfield" <dontmail@address.co.uk.invalid> wrote in message
> news:bqp9kj$fc$1@sparta.btinternet.com...
>> Jumbo wrote:
>> >
>> > I tested it on my PC and it was twice as fast and has no overheads.
>>
>> If you're still talking about your loop-test-with-strlen-call
>> code, you must have a really strange machine.
>
> No the strlen in the loop is not an example that has been made efficient.
> That was just demonstrating one way of many.

There are many trillions of different ways to demonstrate any demonstrable
computing task. To attempt to demonstrate them all is clearly futile, so it
makes sense to concentrate on the good ways.

>> > I'm not saying it will work in every case, but there is nothing
>> > wrong with doing it if you want too.
>>
>> When there is a method that /will/ work in every case, and
>> when that method is easier to remember, easier to code,
>> quicker to code, and quicker to run, I reckon there /is/
>> something wrong with rejecting that other method in
>> favour of a method that is clearly broken.
>
> It's not quicker to run on every implementation , maybe it is if a lookup
> array is used but then your incurring the overhead of the array.

So you concede (by your lack of objection) that it will work in every case,
is easier to remember, easier to code, and quicker to code?

>> > If I want to do this I can:
>> > ......
>> > char ch= 'a';
>> > for(int i=0; i<26; i++)
>> > {
>> > std::cout << ch << " ";
>> > ch++;
>> > }
>> > ......
>> >
>> > The output of this is not the same on every machine so
>> > according some this means code is non compliant.
>>
> No it doesn't rely on anything imagine it is part of a windows program.

If you want to discuss Windows programming, there are newsgroups available
for that kind of discussion. Here, we discuss C and C++, not "stuff that
happens to work on my platform".

-- 
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton


Relevant Pages

  • Re: Array and resize
    ... I will check whether this is also a quicker way to create such a matrix ... >> You are not creating a 2D array, but an array containing arrays, and you ... >> can't drop these onto a worksheet in this way. ... >>> Sub DumpValues() ...
    (microsoft.public.excel.programming)
  • Re: Runs on Windows, fails on Linux
    ... > the windows program WITHOUT debug, and guess what, I'm getting the same ... > simply get properly sorted values back with debug, ... 16 MB ints) under Linux on three different machines (sorry, ... I did check the results by iterating over the sorted array and never ...
    (comp.os.linux.development.apps)
  • Re: [PHP] Better way to store data in memory?
    ... Having to do some complex per pixel manipulation, ... way of storing the pixel data than in an array? ... I was looking at the Shared Memory functions, ... but I doubt that would be much quicker. ...
    (php.general)
  • Re: Heres a Python-like range() for JavaScript. Is it new?
    ... for (i in array) ... and no slower for small ones". ... I think this is worth investigating. ... Well, as I recall, it is quicker in Python, because the test and increment are done by native methods rather than using interpreted code. ...
    (comp.lang.javascript)
  • Re: Array or ArrayList
    ... I think that a byte array is quicker if it will be used inside the program ... to rearrange points in an intensive way. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)

Loading