[haiku-bugs] Re: [Haiku] #10396: [PATCHSET] Make Haiku userland compile and work with Clang

  • From: "stippi" <trac@xxxxxxxxxxxx>
  • Date: Sun, 12 Jan 2014 14:48:30 -0000

#10396: [PATCHSET] Make Haiku userland compile and work with Clang
---------------------------+----------------------------
   Reporter:  js           |      Owner:  bonefish
       Type:  enhancement  |     Status:  closed
   Priority:  normal       |  Milestone:  R1/beta1
  Component:  - General    |    Version:  R1/Development
 Resolution:  fixed        |   Keywords:  clang
 Blocked By:               |   Blocking:
Has a Patch:  1            |   Platform:  All
---------------------------+----------------------------

Comment (by stippi):

 When I still thought there was something broken, I actually tried to add
 the operator[]. If memory serves, I tried adding this:

 Type& operator[] (int const& index)
 {
     return fData[index];
 }

 const Type& operator[] (int const& index) const
 {
     return fData[index];
 }

 But then I got compiler errors about some ambitious conversions,
 specifically in that archiving code, but I don't know if there would have
 been more. So maybe the best option could be the comment. Or maybe just do
 nothing, I just tried to explain what benefit I would personally see with
 not using any operator at all and just having one more line to type. But I
 may not be a good measure for these things. Maybe it is obvious to most
 other people why the pointer operator is enough. After all, when using the
 class, one should look in the header...

 BTW, when googling this stuff, I also read that Type* operator() is
 usually declared const. It makes sense to me. Do you think that should be
 ammended in the header?

--
Ticket URL: <http://dev.haiku-os.org/ticket/10396#comment:28>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: