[haiku-development] Re: Are UTF-8 characters allowed in source?

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 29 Jun 2013 13:52:41 +0200

On 06/28/2013 11:05 PM, John Scipione wrote:
We use UTF-8 in comments like in people's names but I'm wondering if
it is okay to use it in actual code?

I'm doing a bit of cleaning up of DeskCalc and the code to detect π
(the greek letter pi) is a bit obtuse, and potentially incorrect.
Would be okay to use the UTF-8 character directly as in:

if (strcmp("π", token.string.String()) == 0)
     // pi

It's certainly okay, even though I would use:
        if (token.string == "π")
here.

Since Haiku is pure UTF-8, having that as a requirement isn't really too much to ask.

Bye,
   Axel.


Other related posts: