As a first aside, everyone programming in C++ should probably know the basics of using GDB as it (or another debugger). I can give a quick introduction (half an hour or so) if people are interested.
Also, it is generally considered better form in C++ to declare variable like p and d when they are first used rather than declaring them outside the loop. This practice comes both from readability (you don't have to search around to find the type of the variables) and efficiency (the compiler compiler then doesn't have to do work to discover that, for example, the Particle *s from different iterations of the loops are separate and no data propagates between them)
On Apr 10, 2009, at 11:45 PM, Javier Ángel Velázquez Muriel wrote:
Dealing with the code below, if I try to set the particle's coordinates with the commented version, it produces a Segmentation fault. If I use the create function of the decorator with 2 arguments, no failure. I don't really mind using the 2nd version, just reporting.Particle *p; IMP::core::XYZDecorator d;for (IMP::algebra::Sphere3Ds::iterator s = ss.begin(); s != ss.end(); ++s) {p =new Particle(model); d.create(p,s->get_center()); // d.create(p); // d.set_coordinates(s->get_center()); p->add_attribute(radius,s->get_radius(),false); ps.push_back(p); } } _______________________________________________ IMP-dev mailing list https://salilab.org/mailman/listinfo/imp-dev