Skip to content

names of variables changed#11

Open
florencemayo wants to merge 1 commit into
se-research:masterfrom
florencemayo:namesRefactoring2016
Open

names of variables changed#11
florencemayo wants to merge 1 commit into
se-research:masterfrom
florencemayo:namesRefactoring2016

Conversation

@florencemayo

Copy link
Copy Markdown

No description provided.

stopCar();

delete (driver_ptr);
delete (driverGeneric);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of actively deleting a pointer, you should use unique_ptr or shared_ptr to let C++ do that for you.

cout << "Creating Lane Following driver" << endl;
driver_ptr = new LaneFollowingDriver(argc, argv);
if (!driver_ptr) {
driverGeneric = new LaneFollowingDriver(argc, argv);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we shouldn't use pointers but wrap them into unique_ptr or shared_ptr.

cout << "Creating Parking driver" << endl;
driver_ptr = new ParkingDriver(argc, argv);
if (!driver_ptr) {
driverGeneric = new ParkingDriver(argc, argv);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we shouldn't use pointers but wrap them into unique_ptr or shared_ptr.

if (!driver_ptr) {
else if (!laneFollowingButton && !parkingButton && overtakingButton) {
if (driver_state != Overtaking) {
//driverGeneric = new OvertakingDriver(argc, argv);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we shouldn't use pointers but wrap them into unique_ptr or shared_ptr.

laneDriver = new LaneFollowingDriver(argc, argv);
// Init laneDriver module
laneDriver->runModule();
laneFollowingDriver = new LaneFollowingDriver(argc, argv);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we shouldn't use pointers but wrap them into unique_ptr or shared_ptr.


ParkingDriver::~ParkingDriver() {
free(laneDriver);
free(laneFollowingDriver);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf. above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants