Windows获取网络地址、子网掩码等

#include <winsock2.h> #include <iphlpapi.h> #include <stdio.h> #include <stdlib.h> #pragma comment(lib, "IPHLPAPI.lib") #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) /* Note: could also use malloc() and free() */ int __cdecl main() { /* Declare and initialize variables */ // It is possible for an adapter to have multiple // IPv4 addresses, gateways, and secondary WINS servers // assigned to the adapter. // // Note that this sample code

-fsanitize=address 参数作用

在C++的开发中,我们经常会遇到很多和内存有关的错误。其实使用编译器的一些检查功能,可以帮助我们一定程度上减少这样的错误,下面我们介绍一下 -fsanitize=address

C++ 编译器支持标准判断

// 矩形重叠类型注释 // CORNER_OVERLAP // -------------------- // | | // | | // | **********|********** // | * | * // | * | * // ---------*---------| * // * * // * * // ********************* // // ANCHOR_OVERLAP // ---- // | | // | | // *******|**|******* // * | | * // * | | * // * ---- *