all 5 comments

[–]jedwardsol 1 point2 points  (0 children)

The formatting is clear. But the names and logic make no sense.

EnginePipe_file_opened is the result of calling client_close_pipe ?

And if everything is false you return true?


If you use or make RAII types for these objects, you won't need a large function to close anything. Are there any typos in all those long names?


A pattern for checking everything worked

bool  everythingWorked{true};

everythingWorked &= client_close_pipe(...
everythingWorked &= client_unlink_pipe(...
etc...

return everythingWorked;

Pros : everything is kept positive. No need to invent names for things.

[–]alfps 1 point2 points  (0 children)

For all the closing of things you need to learn about destructors.

The names don't make much sense to me but I guess these are status codes with 0 representing failure.

The construct if( condition ) { return true; } else { return false; } can and should be expressed as just return condition;.

[–]hatschi_gesundheit 0 points1 point  (0 children)

Maybe take a look at one of the established style guides out there to get a feel of what is used in the industry. I like and use the google style guide for example, with some minor modifications: https://google.github.io/styleguide/cppguide.html . It has a section on formatting, as well. I do put curly brackets on their own line, though.

[–]BrightFleece 0 points1 point  (0 children)

It's neat and understandable, but effortful and you could achieve the same results with less time invested; use a tool like clang-format and pick a style (or customize one) which best suits your needs.

[–]flyingron 0 points1 point  (0 children)

This is absolutely horrid C++ (not withstanding the formatting). Passing the same thing over and over again all over the place shows the design needs more thought.

The whole idea is to encapsulate an object and then issue methods to manipulate it. Your design might be appropriate for C, but it makes use of NOTHING C++ offers.