Re: trim whitespace



[snips]

On Wed, 25 Aug 2010 15:26:00 +0000, John Kelly wrote:

When I originally asked you to say what the contract was between the
caller and the callee, this was one of the things that you could ave
specified: the code works only on such-and-such type machines. In
effect you did specify that when you said the contract is defined by
what the code does. I.e. you wrote trim for machines where it works

Aside from the ptrdiff_t issue, how can it fail?


and, presumably, you don't care about ones where it won't.

Segfaulting is a caller's error, not a defect in trim(). What other
failure scenario is there?

Err... wasn't one of the key features of your trim() that if fed an
invalid pointer, it would simply march along, trimming memory?

That could very well lead to reading memory you don't own, causing a
segfault - or worse - yet be perfectly consistent with the described
operation of the function - and thus, not a caller error at all.

.



Relevant Pages

  • Re: Style (?) issue
    ... the pointer is sometimes null, ... It depends on the code whether you want to have the test inside "probe_subtree" or inside the caller, but either way the test is part of the algorithm, not a check for argument validity. ... more than 8 digits" So, addsatisfies ... One is to specify that the function will take two values that can be summed to an eight digit number, and it will return that sum. ...
    (comp.arch.embedded)
  • Re: &rest args
    ... When the caller omits some optional arguments, ... specify one argument, ... You also might want to take a look into keyword parameters, ... positional order doesn't matter because the caller specifies them by ...
    (comp.lang.lisp)
  • Re: [PATCH -v3 1/4] printk, Add pr_pfx for library functions
    ... usually need to be specified by the caller. ... If printk is used in library functions, the log level and some prefix ... I just think let caller specify log level and line ...
    (Linux-Kernel)
  • Re: trim whitespace
    ... a terminating NUL byte, then it will gladly read right past the bounds and ... When I originally asked you to say what the contract was between the ... the code works only on such-and-such type machines. ... effect you did specify that when you said the contract is defined by ...
    (comp.lang.c)
  • Re: Advice on TSP support of setting caller ID on lineMakeCall
    ... > both show the caller ID as x100. ... We want to be able to specify a caller ... > you pass the desired caller ID and Name to lineMakeCall so that the TSP gets ... it looks like the CallingPartyID is the field ...
    (microsoft.public.win32.programmer.tapi)