Path: utzoo!utgpu!water!watmath!rbutterworth From: rbutterworth@watmath.waterloo.edu (Ray Butterworth) Newsgroups: comp.lang.c Subject: Re: Quote without comment on char constant expansion Message-ID: <18523@watmath.waterloo.edu> Date: 26 Apr 88 15:50:11 GMT References: <4418@hoptoad.uucp> <3432@haddock.ISC.COM> <7677@brl-smoke.ARPA> <522@sol.warwick.ac.uk> Organization: U of Waterloo, Ontario Lines: 52 In article <522@sol.warwick.ac.uk>, cudcv@daisy.warwick.ac.uk (Rob McMahon) writes: > In article <7683@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: > >In article <11056@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: > >>perhaps there should be a `charize' operator. > > > >It's been voted down (back when we hadn't settled on # and ## yet). > >There has been a comment that &"..." should be allowed in constant > >expressions. > > Maybe now that # & ## have been settled on, it's time for another vote ? > It seems it ought to be there just for consistency, and it would provide > a much cleaner solution than this #c[0] as a constant (is that right ?). > Out of interest, what were the arguments against it ? Better yet, if some future version of the Standard decides that a "charize" operator would be a good thing, what on Earth are they going to call it? ### ? But doesn't "x###y" already have a meaning as "x ## # y"? i.e. x"y" ? Yes, but ### is a longer string, so it is taken as charize just as x+++++y is taken as the illegal "x++ ++ + y" rather than the meaningful "x++ + ++y". But that means that introducing this will break any code that now thinks that ### means ## #. And there might be some in light of the new "L" string prefix. e.g. #define STRING(value) L###value so that STRING(abc) generates L"abc". And if they ever need another new operator, will it be #### ? Good grief! Why did the committee come up with such a limited and non-obvious naming scheme for the preprocessor operators? What would have been wrong with something like: Current Renamed Resyntaxed Meaning #x #string x #string(x) "x" x##y x #glue y #glue(x,y) xy ----- #character x #character(x) 'x' defined(x) #defined(x) #defined(x) preprocessor token x is defined #define STRING(value) L #join #string value or #define STRING(value) #join(L,#string(value)) These new names (or better yet, the new syntax) is certainly more obvious than the ## and # names, it doesn't step on any name space other than the current preprocessor directive, and it allows new preprocessor operators to be added with little difficulty.