Rmtrail.C C/C++ script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: rmtrail.c
  • Last update:
  • Platform: Windows / Linux / BSD / Solaris
  • Language: C/C++
  • Price:Freeware
  • Company: Bob Stout (View more)

Rmtrail.C script description:




Publisher review:
Rmtrail.C Remove trailing whitespace from a string

Note: This can arguably be made better by eliminating the strlen() call and its attendant overhead, or by recoding it operate in a single pass rather than the "go to the end, then back up" algorithm used here. An example is in SNIPPETS - see NOTRAIL.C.

Hoever, a couple of points should be mentioned: 1. A library strlen() is often coded in assembly and, even with the call overhead, may be faster than the same functionality written in C.2. Furthermore, the algorithm in NOTRAIL.C has to potentially examine every character in a string twice (once to compare to NUL, the other to test for whitespace). That it does this in one pass or two is immaterial. By using the two pass approach here, we can take potential advantage of strlen to check for NUL's, then explicitly only test backwards from the end looking for whitespace. For non-trivial strings (i.e. mostly text with a few spaces at the end), this may well be faster. 3. If the potential increase in performance is really *that* important, the most sensible improvement would be o rewite it in assembly.4. The additional algorithmic complexity of the improvements in NOTRAIL.C may arguably decrease maintainability. By contrast, the algorithm here is quite obvious.
Rmtrail.C is a C/C++ script for Snippets scripts design by Bob Stout. It runs on following operating system: Windows / Linux / BSD / Solaris.

Operating system:
Windows / Linux / BSD / Solaris

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5