[PATCH] Introduce cxstring::createEmpty()

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 30 17:15:53 PST 2013


On Jan 28, 2013, at 3:42 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> Hello Argyrios & cfe-commits,
> 
> Here's the first step of the refactoring.  Important points are:
> 
> (1) the name of the function -- we can repaint it whatever color you like;
> 
> (2) a slight behavior change.  We used to differentiate NULL and empty
> "" strings.  This does not make a lot of sense (and the difference was
> never documented), so I chose to normalize to empty "" strings, since
> this eliminates a NULL check in the user code.  (But existing code is
> already polluted with those checks...)

As I mentioned in cfe-dev's  "Refactoring internal CXString APIs" I'm uncomfortable with breaking compatibility with clients.

Also, if we are going to standardize on what string should be returned for the "invalid case", it seems to me that NULL is a better option, CXString is a very general API and an empty string is a potential valid return.
How about we keep current behavior but for new APIs we standardize on using createNull() for the "invalid" cases ?

> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> <cxstring-create-empty-v1.patch>





More information about the cfe-commits mailing list