C-Style Function Suggestions

This page describes the C-style function suggestions – a mechanism suggesting compatible C-style functions for struct and typedef variables.

Overview

Starting from VisualGDB 5.6, using the “.” or “->” operator on struct and typedef variables automatically suggests the functions that take the corresponding type as an argument: Selecting such function with “tab” or “enter” will automatically convert the “.” or “->” operator into a C-style function call:

Customizing the View

VisualGDB shows the suggested C-style functions as if they were coming from a base C++ class. As long as the “Show non-inherited members first” option (1) is enabled, they will appear after the actual fields. You can also explicitly restrict the suggestion list to the fields (2), or disable C-style function suggestion altogether via¬†Tools->Options->Text Editor->C/C++(VisualGDB)->Advanced->Code Completion->Treat C functions as methods.

Supported Types

C-style function suggestions compute the actual type of the expression to the left of the “.” or “-> “operator. Hence, they will work with:

  • Simple variables
  • Fields of other variables
  • Variables defined via preprocessor macros

VisualGDB will automatically recognize if the function takes a pointer to the type, and will insert “&” if needed.

C-style function suggestions also work for typedef-ed types, such as handles. E.g. defining “typedef int SOCKET” will recognize all functions accepting SOCKET as a first argument:

Note that it will not work for types defined via preprocessor (#define SOCKET int).