# Coding Standards

## Google C++ Style

We use the [Google Style Guide](https://google.github.io/styleguide/cppguide.html) and indent with 2-wide spaces. 80-characters wide. Only exception is that we lead function names with a lower-case letter to distinguish from classes (`thisIsMyFunction` in our style, vs `ThisIsMyFunction` in pure Google C++).

## Autoformatting

Take some time to set up an autoformatter in your editor. Keep in mind that the eclipse autoformatter does not put brackets in the right place, but does most of the rest.

For extreme cases, use clang-format **AND BE VERY CAREFUL TO ONLY RUN THIS ON YOUR OWN PACAKGE**.\
&#x20;This will autoformat everything in the package:

```
sudo apt-get install clang-format-3.4 
find -name "*.cpp" | xargs clang-format-3.4 -style=Google -i
find -name "*.h" | xargs clang-format-3.4 -style=Google -i
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ariitk.in/wiki/tutorials/how-to-write-a-ros-package/coding-standards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
