Re: string comparison



bwaichu@xxxxxxxxx wrote:

This is the third time in this thread you have posted without providing
any context and you have already been warned about this by Keith
elsethread. I know that you know how to do this because your last post
quoted context. Continual blatant disregard for basic usenet etiquette
is likely to get you plonked.

> The null termination is a trademark of the string library of functions
> in C.

Null termination is part of the definition of a string. The Standard
defines a string as "a contiguous sequence of characters terminated by
and including the first null character".

> A lot of those functions are horribly written.

If they are "horribly written" in your implementation, that is no fault
of the Standard, or did you mean horribly designed?

> You can write your own string functions to replace those that are
> broken like strcpy and strncpy,

Please explain how these functions are "broken", on second thought,
don't.

> or you can spin your own type of string.

Your own type of string? You can create anything you like and call it
a string but that doesn't make it one.

> You will have to include object files to have any portability.

This makes no sense at all. Object files are inherently not portable.

> And the reason why I look at the assembly is to see how my compiler
> treats the C code I write. I don't care what the standard says if all
> the behaviors are not properly implemented. I know I am coding for a
> gcc compiler, so I need to know how that compiler follows the
> standards.

This is all very well discussed in the gcc documentation, I would think
it would be a little easier to consult that than to try to pick through
the machine generated assembly code. If you don't trust the
documentation, then why trust that the assembler will generate the
machine code properly? Do you check the machine code to see if the
assembler is doing what you expect?

> If I strictly followed the CSS2 standard, mosts pages viewed in IE
> would have problems. You cannot all ways depend upon standards.

You cannot depend on applications that intentionally deviate from
standards, there is a difference here.

Robert Gamble

.



Relevant Pages

  • Re: Basic questions about C
    ... is C closer to assembly language than most others? ... Wasn't it the ANSI standard that did this? ... but not to say that C is portable assembler or whatever. ... Except when calculating the string length. ...
    (comp.lang.c)
  • Re: Why is it dangerous?
    ... learn that C had such weak string handling, ... Exploiting getson an auto buffer ... that omitted any standard on what could or could not be input. ... the pedants, on whose code contains more *actual* bugs. ...
    (comp.lang.c)
  • Re: Anyone object to the following change in libc?
    ... sscanfinput string. ... ISO C standard" refers to "c89", which is the version of the C ... non-sensical format specifier entirely, since any characters that ... conformance test suite for ISO C complaining about the ...
    (freebsd-current)
  • Re: A C++ Whishlist
    ... > people from inclusion in a standard. ... > creating their own string class. ... >>don't want an ever increasing size of exception specification on each ...
    (comp.lang.cpp)
  • Re: improve strlen
    ... The biggest optimization is that the code is bigger. ... each test string is tested ... The object on right side is type tree, ... The way I see it is that C is portable assembler, ...
    (comp.lang.asm.x86)