Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Clem Clarke <oscarptyltd@xxxxxxxxxxxxxx>
- Date: Wed, 18 Apr 2007 22:23:52 +0800
Obviously, there are two streams of thought here, those that think there is a problem, and those that don't. And some people think that there is a C string type.
Those that say there isn't a problem, and that it is the programmer's fault perhaps have forgotten that seat belts were introduced into cars (and variable crumple rates) to protect people if an accident happens. It is true that an accident is caused by cars (well, most cars...) but rather the driver. And it is precisely because drivers do cause accidents, we have safer cars. Indeed, cars handle much better than they used to, and have many more safety features built in. And computer languages should be safer, rather than not (safer). We ALL make mistakes!
And for those people that suggest that C does have a string type, I would suggest that it doesn't, compared with Pascal, PL/I, COBOL or even Assembler. It has an array of characters, which is quite different from a string.
For example, in PL/I, one could write:
Dcl String10 char(10) varying;
Dcl String20 char(20) varying init
('Long 20 Character XX');
String10-string20;
This will automatically truncate the result, rather than copy the 20 bytes and overwrite adjacent storage, as in C.
And so naturally, I agree with those that say there is a problem.
What is needed is for ANSI to bite the bullet and fix the problem. Or for someone big, like IBM to do it, and force a standard change. (As an aside, there is a language called D, which has a length word for strings, I believe. It is written by Walter Bright, who wrote the original Zortech C compilers. Bright by name, bright by nature... I think it uses the GCC C compiler as a backend.)
But I shall write to ANSI now. Again, I think....
The thing is that there is quite a lot of straight C code making it's way into IBM's Z/OS at the moment. And it should take into account these performance robbing routines, because mainframes usually run thousands of programs at once, rather than the tens or hundreds that a Linux box might. Therefore, overheads need to be kept to a minimum (as they should always be...).
Clem
.
- Follow-Ups:
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Keith Thompson
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- References:
- Text-Based Windows Library
- From: hstagni
- Re: Text-Based Windows Library
- From: bytebro
- Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Clem Clarke
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Richard Heathfield
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: user923005
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Richard Heathfield
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: user923005
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Kelsey Bjarnason
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: user923005
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Keith Thompson
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: user923005
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: Keith Thompson
- Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- From: websnarf
- Text-Based Windows Library
- Prev by Date: gcc 64bit compiler does not offer any speed advantage
- Next by Date: Re: segmentation fault: what is it
- Previous by thread: Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- Next by thread: Re: Fast and Safe C Strings: User friendly C macros to Declare and use C Strings.
- Index(es):
Relevant Pages
|