TRIM
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Jul 18 23:50:00 GMT 2014
On Fri, Jul 18, 2014 at 02:59:16PM -0700, Jerry DeLisle wrote:
> On 18/07/14 02:08, Salvatore Filippone wrote:
> > Thanks Arjen.
> > A bit of context: an intern was testing some code that was not doing
> > what it was supposed to do because it was driven by character inputs
> > and in one of them there were trailing tabs that TRIM did not remove.
> > I guess I'll have to implement my own, and of course this will open
> > an uncountable infinity of cans of worms as soon as I straddle any
> > operating system boundary.....
> >
>
> The reason we don't trim tabs is to provide training fodder for all new computer
> users. It has been done this way for over half a century in order to build
> character and develop attention to detail. Without this feature our younger
> generations might start thinking the computer can do everything.
>
Actually, it is a little more complicated than one may think.
After forcing alignment, gfortran skips trailing blanks in
word size chunks. Look in the code, you find 0x20202020 (may
have the number of 20s wrong here). If tab were treated like
a blank the optimization of looking for 0x20202020 would need
to check for 0x20202020, 0x20202009, 0x20200920, 0x20092020, etc.
Or, the implementation would need to be unoptimized.
--
Steve
More information about the Fortran
mailing list