News for hackers. Stuff that matters.

~=

Check this out:

http://www.google.com/search?q=%22~=%22

Any reason why we couldn't add ~= to the c spec so that we could say:

myVar ~= myFlag;

Which would do the same thing as:

myVar &= ~myFlag;

( 5 comments | 3 points | on HN )
Re:~= by danger on Thursday August 11, 2011 @05:47PM (#2874981)
Re:~= by mooism2 on Thursday August 11, 2011 @06:22PM (#2875083)
Cons:

* inconsistent with other compound assignment operators

* looks like regular expression matching operator used in other languages

Pros:

* shortens certain expressions by one character

I don't think it's worth it.

What does the search query have to do with it?

Re:~= by buzzzlight on Thursday August 11, 2011 @09:32PM (#2875588)
I was just shocked that no language anywhere had thought of it yet. I can't even remember the last time I did a search that came up empty.
Re:~= by mooism2 on Friday August 12, 2011 @02:17AM (#2876195)
Re:~= by forther on Thursday August 11, 2011 @05:55PM (#2875005)
it's just not consistent. All current assignment "modifiers" are "binary" operators and ~ is unary one.