Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Java compatibility issues (WAS: MF having issues?)
Frank Swarbrick wrote:

> You're right.  As I said, I couldn't recall if =3D=3D would compare string
> values or just their references.  In C# it compares values.

It may, or may not, compare values depending on what is defined for
that class and what has been overloaded.

For example it may be that if you had:

if ( stringobject =3D=3D 23 )

This may compare the length of the string with the integer, such is the
wonder of overloaded operators. The point being that you cannot tell
what it is going to be doing without looking at the class or
documentation for it.

Which is why I dislike overloading of operators.

> I don't know Python, really, other than a little reading.  Can you show me
> how you might code the equivalent of a case statement?

Just a series of if .. elif .. elif .. else. In python the =3D=3D operator
does compare strings so:

if ( control =3D=3D =A8one=A8 ):
one()
elif ( control =3D=3D =A8two=A8 ):
two()
else:
thisdefault()

> I think that one is much more likely to forget a 'break' statement than o=
ne
> is to comment out a single COBOL statement and having it drop through.

That may depend on how experienced one is in the various languages and
how easily one switches from one to the other. I can=B4t recall the last
time that I forgot a break, but I do recall having done it when I
started with C.

> Which is not to say that there isn't a third, better, way.  Such as,
> maybe...

But why not just be explicit about what you actually want with:

if ( this =3D=3D =A8one=A8
or this =3D=3D =A8two=A8 ):
do_one_or_two()
elif ( ...

> Just off the top of my head, but this might be just as flexible and less
> prone to mistakes.

If it is _different_ then it will lead to mistakes.  Java is fine for C
programmers _because_ it is the same.

> Yep.  As I said in a previous message, I don't like this.  It seems to me
> I'm much more likely to want to do a "value" compare than a "reference"
> compare, so to me the "value" compare should be the "basic" compare.  Just
> my opinion, obviously.

Then don=B4t use Java or C.  In C one would use if ( strcmp(string1,
string2) =3D=3D 0 ) or similar to compare two strings. If ( string1 =3D=3D
string2 ) compares the two addresses. It is the way that the language
works, if you don=B4t like it then choose another. Personally, I have no
trouble switching to use what is provided by the language I am using at
the time.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
03-09-06 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:30 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.