# Coding style

### Naming Style

For functions and variables, you should start with capital case characters, and for each word, you should start with capital characters. You should not use underline `_` on these names.

For structures and enum names, you should write them all in capital characters and separate each word by one underline `_` .

### Clang Format

We use [this ](https://github.com/HyperDbg/HyperDbg/blob/master/hyperdbg/.clang-format)clang-format for writing codes in our C driver.

Please make sure to format the code using clang format's visual studio extension or clang command-line tools.

### Comments

Putting comments on the code is very important. This way, other people can understand your code better and will be used for further improvement.

Please put the comment in this style.

```c
//
// This is my comment line 1
// This is my comment line 2
//
```

### Global Variables

All global variables should start with `g_` for example `g_GuestState`.

### File Names

For drivers, file names start with a capital case character.

For user-mode codes, file names start with lower case characters.

### Directory Names

All the directory names should be with lower case characters, you should not use space, and instead of that, you can use `-`.

### Printing Messages

In HyperDbg, in most cases, if the printed message came from kernel-mode or vmx-root mode, then the first letter is capitalized, while if the message is generated from the user-mode debugger, it starts with lower-case characters.

### Error Styles

Exactly, like the above conventions for "Printing Messages", errors follow the same rule.

In HyperDbg, errors might come from either user-mode codes, kernel-mode, or vmx-root mode. Because we want to know the root cause of the error, we follow the rule of "`Err,` " and "`err,` ".

If the error starts with `err,` then, it means that the user-mode code generated this error. If the error started with `Err,` it means that it was either kernel-mode or vmx-root mode that encountered this error.


---

# 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://docs.hyperdbg.org/contribution/style-guide/coding-style.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.
