Mail Archives: djgpp/2001/09/29/14:49:03
On Sat, 29 Sep 2001 17:56:29 GMT, Les Cargill
<lcargill AT worldnet DOT att DOT net> wrote:
>Radical, NetSurfer wrote:
>>
><snip>
>> by programming around it, you will note that using the
>> philosophy of GCC/GXX, it is necessary (right?) to
>> make TWO SEPARATE ISOLATED CALLS to
>> printf()....
>> well, all I can say is... I wish someone would FIX IT!
>>
>
>Why? It's not broken. This devolves to an argument about what "broken"
>means, in this case.
>
>> ...and now we return you to your normally scheduled
>> reality channel....
>>
>
>Perhaps 'C'/C++ is not for you... just a thought. FWIW,
>*any* implementation that reverses the string
>in place, written in Ada, Forth, assembly, Cobol
>or Fortran would have exactly the same side effect.
>
>Now:
>
>void thing(char *inputstr)
>{
> char temp[SIZE};// SIZE to be named later
> assert(strlen(inputstr) < SIZE);
> memcpy(temp,inputstr,strlen(inputstr));
> strrev(temp);
> printf("original string = %s, reversed string = %s\n",inputstr,temp);
>}
What? Simple, ordinary strdup() was not good enough for you?
>Any implementation in 'C' which hides context takes on a much more
>sophisticated role than one that doesn't. The "simpler is better"
>principle dictates that doing this is not necessarily good. If the
>implementation allocates memory, the program now has to
>dispose of it. If a static buffer is used, unless the application is
>100% serialized about that object, unpredictable things will happen.
>
>C++ attemps to do something about this, at a cost in complexity and
>raggedness of the context*. Java forces the use of garbage
>collection, as do Lisp and other languages.
>
>*Not too bad in this case, but a slight generalization reveals that there is no
>good general solution to the problem.
>
>It's a vale of tears.
>
>FWIW, Tcl would, interetsingly enough, work great in this instance. All
>names are strings, and all values are strings, so the context can be completely
>opaque. Kewl. Unfortunately, Tcl smudges scope, so there are the attendant
>problems
>with that, too.
>
>> email: radsmail AT juno DOT com
>> http://members.tripod.com/~RadSurfer/
>>
>> Join us on Yahoo at:
>> http://groups.yahoo.com/group/BorlandCPPBuilder
>> for informal discussions about all versions of C++Builder...
>> [Computer programming for Windows 95, and Console32]
>> (you must be a Yahoo member to join)
char *strrev(const char *str) ; //use strdup !!
da solution...at least.... SHEESH PEOPLE!
- Raw text -