Not so much a bug...
-
I found this in some C++ code I've inherited. The preceding code isolates a file extension into an STL string, strExt. The code then does case sensitive compares against a range of file extensions and branches to appropriate code. Somewhere along the line my predecessor must have run into a variety of capitalisations, hence this.
else if (strExt == _T(".txt") || strExt == _T(".TXT") || strExt == _T(".Txt"))
the mind boggles. Why didn't he go the whole hog and put in all possible variants? Who knows? :omg::omg:
Rob Manderson I'm working on a version for Visual Lisp++ My blog http://blogs.wdevs.com/ultramaroon/[^] My blog mirror http://robmanderson.blogspot.com[^]
-
I found this in some C++ code I've inherited. The preceding code isolates a file extension into an STL string, strExt. The code then does case sensitive compares against a range of file extensions and branches to appropriate code. Somewhere along the line my predecessor must have run into a variety of capitalisations, hence this.
else if (strExt == _T(".txt") || strExt == _T(".TXT") || strExt == _T(".Txt"))
the mind boggles. Why didn't he go the whole hog and put in all possible variants? Who knows? :omg::omg:
Rob Manderson I'm working on a version for Visual Lisp++ My blog http://blogs.wdevs.com/ultramaroon/[^] My blog mirror http://robmanderson.blogspot.com[^]
*grin* that's just great.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
I found this in some C++ code I've inherited. The preceding code isolates a file extension into an STL string, strExt. The code then does case sensitive compares against a range of file extensions and branches to appropriate code. Somewhere along the line my predecessor must have run into a variety of capitalisations, hence this.
else if (strExt == _T(".txt") || strExt == _T(".TXT") || strExt == _T(".Txt"))
the mind boggles. Why didn't he go the whole hog and put in all possible variants? Who knows? :omg::omg:
Rob Manderson I'm working on a version for Visual Lisp++ My blog http://blogs.wdevs.com/ultramaroon/[^] My blog mirror http://robmanderson.blogspot.com[^]
NTFS does case insensitivity simply by uppercasing both strings using an upper-casing table stored in the filesystem metadata. This table is similar to using the invariant culture IIRC. See http://blogs.msdn.com/michkap/archive/2004/12/02/273619.aspx[^] and http://blogs.msdn.com/michkap/archive/2005/01/16/353873.aspx[^].
Stability. What an interesting concept. -- Chris Maunder
-
I found this in some C++ code I've inherited. The preceding code isolates a file extension into an STL string, strExt. The code then does case sensitive compares against a range of file extensions and branches to appropriate code. Somewhere along the line my predecessor must have run into a variety of capitalisations, hence this.
else if (strExt == _T(".txt") || strExt == _T(".TXT") || strExt == _T(".Txt"))
the mind boggles. Why didn't he go the whole hog and put in all possible variants? Who knows? :omg::omg:
Rob Manderson I'm working on a version for Visual Lisp++ My blog http://blogs.wdevs.com/ultramaroon/[^] My blog mirror http://robmanderson.blogspot.com[^]
-
Rob Manderson wrote:
Why didn't he go the whole hog
Why didn't he just LowerCase the entire string and do the one comparison :confused: not sure if he has access to a function like toLower(string s)
Heh - that's the correct solution. My comment was meant to underline the silliness of his approach...
Rob Manderson I'm working on a version for Visual Lisp++ My blog http://blogs.wdevs.com/ultramaroon/[^] My blog mirror http://robmanderson.blogspot.com[^]