develooper Front page | perl.perl6.language.mlc | Postings from August 2000

Re: why not just use C /* ... */ ?

From:
iain truskett
Date:
August 23, 2000 15:39
Subject:
Re: why not just use C /* ... */ ?
Message ID:
20000824084145.I10009@eh.org
* Damien Neil (neild@misago.org) [24 Aug 2000 08:27]:
> On Thu, Aug 24, 2000 at 06:53:31AM +1000, iain truskett wrote:
> > >    /* File: C:\user\jv\demo.java */
> > 
> > > t.java:1: Invalid escape character.
> > > /* File: C:\user\jv\demo.java */

> > In that situation, I would say that the java compiler isn't really
> > doing what it should be doing. i.e. That looks like a bug, not a
> > feature.  gcc does no such thing with its comments.

> That would be because gcc is a C compiler, not a Java compiler.

> Java permits you to write Unicode characters as escape sequences like
> this: \u1234.  This translation can occur within comments, and the
> above comment contains an illegal \u escape sequence.

Aah. Now it makes sense (amazing how little of Java one can learn in two
years when one doesn't like the basic syntax of it).

Does it try to parse other escape sequences (such as \t, \n, \r etc.) or
just the Unicode one?

If just the Unicode one then I'd say the problem is a feature, not a
bug (reversing my stance), but one we probably don't have to worry about
since it's peculiar to Java. Right?

It's a gotcha, but not a drastic one.


cheers,
-- 
iain truskett, aka Koschei.                    <http://eh.org/~koschei/>
      "But you have access to the greatest source of knowledge in the
             Universe!"
      "Well...I do talk to myself sometimes, yes..."



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About