From: Seungbeom Kim on
On 2010-05-17 11:24, cpp4ever wrote:
>
> Finally I came across an instance where folks had developed code where
> a member function would delete *this object, (delete this;). IMHO this
> is appalling and have never done it myself. So, can anyone justify doing
> this, as it is a potential time bomb for future development.

I don't do it often either, but it's okay and sometimes it's needed;
for example, I remember having to do it in MFC modeless dialog classes.

C++ FAQ Lite [16.15]
Is it legal (and moral) for a member function to say delete this?
http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.15

--
Seungbeom Kim

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Razvan Cojocaru on
> Not sure about the high IQ bit, but IQ is a measure of a fairly
> specific type of pattern recognition, so I'm not overly impressed by
> high IQ scores. As for C++ being a useful skill, I find that most

I should have been more precise, I didn't mean to talk about IQ tests
specifically (and yes, I agree they tend to be not quite relevant in
most cases). I actually meant good old intelligence, in all the ways
people have observed it before and after standardized IQ tests.


> vacancies require experience with boost, oracle, or other libraries, and
> not just STL.

But surely boost is still C++. WxWidgets and QT are still C++.

I guess you're talking about C++ as meaning just the language and the
standard libraries? I thought by C++ you mean everything coded in C++ -
and you really can't talk about professional C++ development without
being able to use C++ to manipulate a relational database, concurrent
programming and GUI applications.


> Then, many of them require good academic results, and or
> specific experience, although I've never been convinced that is any
> guarantee of a good C++ developer, or the code they've developed or
> develop be easy to maintain or develop. As I don't meet the previous 2
> criteria, getting an opportunity to use any C++ skills I may have is not
> easy. So those C++ skills have hardly flattered my career development.

Sorry to hear that, but all things being equal I still stand by my
position - C++ is just a safer bet.

In my experience, the school grades are only required when there's no
prior experience to speak of. You're right that previous experience does
not guarantee the candidate will meet a high standard as a C++
programmer, but you should take into account that prior experience is
not only something an employer looks for to show that you've mastered a
programming language, but something that shows them you can "play ball",
be a "team player", got "what it takes", and so on (insert HR cliche
here). And prior experience doesn't only mean experience with C++ -
there's a bunch of tools you're supposed to be comfortable with, CVS,
Subversion, Vim, (X)Emacs, GCC, GDB, Visual Studio, Bugzilla, etc. Not
to mention workplace dynamics - can you fit into an Agile team, do you
know what Scrum means, etc. There are also good habits that tend to form
when working with a team rather than alone - developing unit tests as
you write your code, automated functional testing, etc.

My advice to you is to get your feet wet with a serious open source
project. This will give you some visibility, and will create some
tangible experience that you can put on a CV.


> Finally I came across an instance where folks had developed code where
> a member function would delete *this object, (delete this;). IMHO this
> is appalling and have never done it myself. So, can anyone justify doing
> this, as it is a potential time bomb for future development.

Look up the usual implementation for IUnknown::Release(). IUnknown is an
abstract class (an interface) that all COM+ objects must implement. It
has the pure virtual member functions AddRef() and Release() that you're
supposed to implement (i.e. it requires basic reference counting
implementation).

http://msdn.microsoft.com/en-us/library/cc839627.aspx
http://research.microsoft.com/en-us/um/redmond/projects/invisible/iunknown.htm#Release


> As for my age, well I finished my degree 20+ years ago should point
> you in the general direction of my age.

OK, I falsely assumed that you're younger, given your perceived level of
enthusiasm for C++. But we're as young as we feel :).


All the best,
--
Razvan Cojocaru
KeyID: 0x04CA34DE


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: cpp4ever on
>
> But surely boost is still C++. WxWidgets and QT are still C++.
>
> I guess you're talking about C++ as meaning just the language and the
> standard libraries? I thought by C++ you mean everything coded in C++ -
> and you really can't talk about professional C++ development without
> being able to use C++ to manipulate a relational database, concurrent
> programming and GUI applications.
>
>
>> Then, many of them require good academic results, and or
>> specific experience, although I've never been convinced that is any
>> guarantee of a good C++ developer, or the code they've developed or
>> develop be easy to maintain or develop. As I don't meet the previous 2
>> criteria, getting an opportunity to use any C++ skills I may have is not
>> easy. So those C++ skills have hardly flattered my career development.
>
> Sorry to hear that, but all things being equal I still stand by my
> position - C++ is just a safer bet.
>
> In my experience, the school grades are only required when there's no
> prior experience to speak of. You're right that previous experience does
> not guarantee the candidate will meet a high standard as a C++
> programmer, but you should take into account that prior experience is
> not only something an employer looks for to show that you've mastered a
> programming language, but something that shows them you can "play ball",
> be a "team player", got "what it takes", and so on (insert HR cliche
> here). And prior experience doesn't only mean experience with C++ -
> there's a bunch of tools you're supposed to be comfortable with, CVS,
> Subversion, Vim, (X)Emacs, GCC, GDB, Visual Studio, Bugzilla, etc. Not
> to mention workplace dynamics - can you fit into an Agile team, do you
> know what Scrum means, etc. There are also good habits that tend to form
> when working with a team rather than alone - developing unit tests as
> you write your code, automated functional testing, etc.
>
> My advice to you is to get your feet wet with a serious open source
> project. This will give you some visibility, and will create some
> tangible experience that you can put on a CV.
>
>

The delivery logistics software I worked on in the past was considered
to be difficult and complex, and i was employed based on my C++ test
results. Now I'm sure many of the other candidates had more C++ work
experience than I. Then for a year I was supporting a graduate with C++
difficulties on an almost daily basis. If that isn't a test of ones C++
skill and understanding, what is?
As for using other tools, as a Linux user who maintains a Laptop and a
standard PC I've learnt to use a variety of tools, and you mention a few
of them. Even so, I sometimes think employers expect folks to have an
expert knowledge of all the libraries and tools they use, without
looking for evidence of adaptability and initiative. This is clearly
impractical if the need for a developer is really urgent, but if they're
on a fishing exercise it makes sense. Lastly, if giving up your free
time, social and family life is expected as often appears to be the case
then I'm not interested. On the last point I'm of the opinion that most
folks have ~4 hours of creative and productive ideas a day, and past
about 7 hours they start making too many mistakes to make that extra
time all that valuable.

JB

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: cpp4ever on
On 05/18/2010 04:51 PM, Seungbeom Kim wrote:
> On 2010-05-17 11:24, cpp4ever wrote:
>>
>> Finally I came across an instance where folks had developed code where
>> a member function would delete *this object, (delete this;). IMHO this
>> is appalling and have never done it myself. So, can anyone justify doing
>> this, as it is a potential time bomb for future development.
>
> I don't do it often either, but it's okay and sometimes it's needed;
> for example, I remember having to do it in MFC modeless dialog classes.
>
> C++ FAQ Lite [16.15]
> Is it legal (and moral) for a member function to say delete this?
> http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.15
>

Somehow it comes as no surprise to me that many examples of this are
from Microsoft code. I remember many years ago comparing MFC and OWL and
thinking that the MFC was messy,and appeared to be botched together in a
hurry. Perhaps that's why it seems to have been abandoned to some extent.

As your reference to C++ FAQ Lite points out, the need for 100%
certainty in key ways makes this technique a recipe for future problems.
I'll not be using it, except under extreme duress, and then unhappily.

JB

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]