[ADMB Users] fixing the ivsort.cpp code

dave fournier otter at otter-rsch.com
Sun Jan 1 10:46:49 PST 2012


Ben thinks this should be developers stuff, but I think users should see 
the warts so they
know what is going on. (If you want the bugs hidden from you use R).
The main thing is to get rid of the C like constructions in the code.
However sometimes you need to pass an ivector to some C code which expects a
point to int  because you don't
have the time or energy to rewrite the C code.  The right way to do this is

    ivector v(1,10)

    myfun(&(x(x.indexmin()));


where the prototype for myfun is

   void myfun(int * x);

Rhen if later on you change x to

    ivector x(0,12);

the code will still work.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ivsort.cpp
Type: text/x-c++src
Size: 2564 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20120101/d11842dd/attachment.cpp>


More information about the Users mailing list