[PATCH] Introduce cxstring::createEmpty()

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Feb 1 08:44:56 PST 2013


On Feb 1, 2013, at 8:40 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Thu, Jan 31, 2013 at 3:15 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>> 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 ?
> 
> Thank you for the review.  I agree that compatibility is of high
> importance.  I have committed createNull()/createEmpty() in r174173,
> r174174.  I've added an explanation in r174195, please tweak the
> comment if you have a better wording.

LGTM, thanks!

> 
> 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>*/





More information about the cfe-commits mailing list