For Programmers: Free Programming Magazines  


Home > Archive > ASM370 > June 2007 > Fast and Safe C Strings: User friendly C macros to Declare and use









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fast and Safe C Strings: User friendly C macros to Declare and use
Clem Clarke

2007-04-13, 3:57 am

Some 20 years ago, it became clear that C strings were not as safe, nor
as fast, as strings in PL/I, Assembler or Pascal.

The primary reasons are that one needs to find the current length of a
string before or during a copy process - this is very time consuming.

Secondly, there is no way of determining the maximum length of a string,
and therefore when copying to a string, it is easy to over-write
adjacent storage with often disastrous consequences, including the
deliberate introduction of viruses.


Decades have passed and the C string problem continues. Buffer
over-runs are just part of the story, and the bugs that can be
introduced - the safety problem is still with us all and it has come
back to bite all of us on the lower part of our anatomy, over and over
again.

I have spent some years studying this problem and have developed some
User friendly C macros that solve the problem.

These solutions do enhance the speed and safety aspects of all "C"
programs - these benefits of speed and safety can be passed on to your
users.

The main benefits are:

* Increased speed (up to 20 times for some string handling)
* More reliability (strings cannot overwrite adjacent storage)
* Easier coding and debugging (consistent set of macros)
* Easier external variables

Here is a very short example:

dcl (op,charvar,253," ",ext); // Variable 'op' is defined
// as an External variable - Max length of 253 characters.
dcl (symbolic,charfixed,8," ",ext); // Fixed length of 8

cpylit(op, "This is a 30 character string ");
cat(op,op); /* Concatenate variable op with it self. Now 60
characters */

cpy(symbolic,op); /* Truncates it to 8 characters */

cpy(op,symbolic); /* Copy it back. */

I invite you download the macros and code at
http://members.ozemail.com.au/~osca...d/fastsafe.html where a fuller
discussion can be found.



Clement Clarke



,-._|\ Clement V. Clarke - Author Jol, EASYPANEL, OSCAR, 370TO486
/ Oz \ Web: www.ozemail.com.au/~oscarptyltd
\_,--.x/ 38 Kings Park Road, West Perth, AUSTRALIA, 6005.
v Tel (61)-8-9324-1119, Mob 0401-054-155.
Tedtenhadick

2007-04-23, 7:46 pm

http://Mel-Gibson-spanking.info/Win...hp?movie=148803
Ansterjoha

2007-05-07, 2:47 pm

http://Mel-Gibson-spanking.info/Win...hp?movie=148803
Erposterter04

2007-06-07, 12:58 pm

Cameron Diaz and Helen Hunt Lesbians Get Messy With Food!
http://www.shockingtheworld.com/WatchMovie?id=1673286

Lindsay Lohan and Lindsay Lohan Lesbians Get Messy With Food!
http://www.shockingtheworld.com/Play?clip=1673286

Hilary Swank and Alyssa Milano Tongue Tickles Lesbian Lovers Pussy Movies!
http://www.shockingtheworld.com/Watch?id=1673286

Christina Aguilera and Paula Abdul , Lesbian Blondes On Table!
http://www.shockingtheworld.com/watch?clip=1673286

Jennifer Aniston and Catherine Z. Jones Licking Pussy!
http://www.shockingtheworld.com/PlayMovie.wmv?q=1673286
Sedetapmaplem4

2007-06-17, 11:46 am

My girlfriend cheated on me! Here is the revenge, look how I f^^^ed her!
http://xx-amateur-movies.org/vid/218571/
Please share with friends
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com