a small suggestion for Option() in crafty

Discussion of chess software programming and technical issues.

Moderator: Ras

wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

a small suggestion for Option() in crafty

Post by wgarvin »

I notice in option.c of Crafty 23.4 this code:

Code: Select all

  if (StrCnt(buffer, '/') >= 7)
    nargs = ReadParse(buffer, args, " 	;=");
  else
    nargs = ReadParse(buffer, args, " 	;=/");
The string literals passed to ReadParse each contain a space character, a tab character, and some other separators.

I would just like to suggest that you might replace the tab characters with the escape code \t, so that you don't have actual control characters in the source code.

Code: Select all

  if (StrCnt(buffer, '/') >= 7)
    nargs = ReadParse(buffer, args, " \t;=");
    ...
The specific reason I'm suggesting this, is because the text editor I use has a function to convert "Tabs to Spaces" which I sometimes use when re-formatting source code to make it more convenient to browse through. I've been doing that for years, and this is the first time I've come across a piece of source code whose semantics would be changed by that conversion! :lol:
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: a small suggestion for Option() in crafty

Post by bob »

wgarvin wrote:I notice in option.c of Crafty 23.4 this code:

Code: Select all

  if (StrCnt(buffer, '/') >= 7)
    nargs = ReadParse(buffer, args, " 	;=");
  else
    nargs = ReadParse(buffer, args, " 	;=/");
The string literals passed to ReadParse each contain a space character, a tab character, and some other separators.

I would just like to suggest that you might replace the tab characters with the escape code \t, so that you don't have actual control characters in the source code.

Code: Select all

  if (StrCnt(buffer, '/') >= 7)
    nargs = ReadParse(buffer, args, " \t;=");
    ...
The specific reason I'm suggesting this, is because the text editor I use has a function to convert "Tabs to Spaces" which I sometimes use when re-formatting source code to make it more convenient to browse through. I've been doing that for years, and this is the first time I've come across a piece of source code whose semantics would be changed by that conversion! :lol:
Will do. No telling when that was done...