Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Convert "invalid" characters to underscore

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Hvergelmir Posted - Aug 21 2018 : 11:06:48 AM
I am using the following alternative to the shipped ifdef header guard.

#ifndef __$FILE_BASE_UPPER$_$FILE_EXT_UPPER$_VER__
#define __$FILE_BASE_UPPER$_$FILE_EXT_UPPER$_VER__ $YEAR$$MONTH_02$$DAY_02$$HOUR_02$
#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
#pragma once
#endif /* Check for "#pragma once" support */

$selected$
#endif /* __$FILE_BASE_UPPER$_$FILE_EXT_UPPER$_VER__ */


However, you can probably already tell the issue here. Say I have a header file named foo-bar.h the outcome of the first line when "rendered" will be:

#ifndef __FOO-BAR_H_VER__

... all fine, except for the hyphen in the name. It would be great if there was some kind of filter I could apply to these built-in variables in order to convert hyphens and other characters that would be invalid inside identifiers into underscores. Either some kind of "filter function" or alternative versions of the built-in variables would be great for the purpose.

Thanks.
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 22 2018 : 08:13:09 AM
I had always suspected upper casing the filename was to do with complying with standards for comment blocks at the start of a file. It obviously depends on what random things you have seen over the years, and different people see different random things.

Short filenames feel limiting, but if grouped sensibly by directory they don't have to be a problem. At least it avoids ending up with stupidly long filenames, which I have also seen happen
Hvergelmir Posted - Aug 22 2018 : 06:19:05 AM
Thanks. Yeah, there's a whole bunch of them. I guess whenever one uppercases the whole file name using this method the intention is to use it as some kind of identifier or similar. But perhaps there are other reasons I haven't considered :)

In an ancient code base I work on, developers (unhelpfully, I may add) have decided to stick to 8.3 DOS file names as the maximum (only ASCII digits and letters allowed, a dot to separate the extension and the extension itself). Since one of the developers is working on this code for nearly 30 years, he gets to make that call, though.
feline Posted - Aug 21 2018 : 4:15:34 PM
I had never actually considered this, since nearly all of my file names are also safe identifier names, an old habit I must have picked up somewhere along the line. But trying this, I can use several unhelpful characters in a Windows filename. I have put in a feature request for new versions of the FILE tokens that are identifier character safe:

case=118582

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000