freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pooma-dev] RFA: Fix Utilities Typos and Prevent Warnings


From: Allan Stokes
Subject: RE: [pooma-dev] RFA: Fix Utilities Typos and Prevent Warnings
Date: Sat, 17 Mar 2001 04:29:53 -0800

ElementProperties.h:

        * Add a missing include directive.

I would need gcc to check this.  I'll take your word for it.


Inform.h:

        * Permit use of std::ios_base::fmtflags for current gcc versions.

This is what you have:
<<<<
#if (defined(__MWERKS__) && __MWERKS__ >= 0x2301)
|| __GLIBCPP__ >= 20001129
>>>>

Do you want this instead?
<<<<
#if (defined(__MWERKS__) && __MWERKS__ >= 0x2301)
|| defined(__GLIBCPP__) && __GLIBCPP__ >= 20001129
>>>>

I'm concerned that the first form will crap out on platforms where
__GLIBCPP__ is not defined at all.



RefCountedBlockPtr.h:

        * Add a missing include directive.

Harmless at worst.


tests/delete_test1.cpp:

        * Add a static_cast for conversion from float to int to avoid a
        compiler warning.

Can't be any worse than it was, and now the badness is more apparent.


        * Add a static_cast around iterator.

Ugh.  Syntactically correct, but not desirable as written.  This is the one
where Jim thinks he wanked vector<int> to become vector<double> for some
spurious reason.  I propose a different fix in the included file (the CVS
server went moribund so I couldn't take a diff).

I'm using some extra type declarations and a value constructor on the target
type rather than a static cast.  kcc compiled my version without complaint.


tests/find_most_common_test1.cpp:

        * Change which overloaded check function to use to permit
        compilation.

Stylistically, this unit leaves a lot to be desired.  It's conventional
practice with the STL that you typedef your use of container types like
this:

  typedef std::map<int,int> my_map;
  typedef my_map::iterator my_map_iter;

// or better

  typedef int my_key;
  typedef int my_value;
  typedef std::map<my_key,my_value> my_map;
  typedef my_map::iterator my_map_iter;

If you find yourself fixing this kind of mess frequently, just slap in the
missing typedefs and try to make sense of things from there.

The actual problem here doesn't involve STL types, but it would take some
time to track t.check() backwards and I'm tired.  KCC doesn't complain about
the use of the three argument call to check().  So I have some doubts that
your change reflects the semantic intent, whatever it might have been.

Attachment: delete_test1.cpp
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]