Default macros of GCC/Debug __func__ etc

27 篇文章 1 订阅
26 篇文章 0 订阅

X86/GCC/Linux  ## on x86-64bit host 

gcc -posix -E -dM - < /dev/null 

#if defined(__x86_64__) || defined(_M_X64)

    /* x86 64-bit ----------------------------------------------- */

#elif defined(__i386) || defined(_M_IX86)

    /* x86 32-bit ----------------------------------------------- */

#endif

Example 

        printf(__DATE__":"__TIME__"\n");
        printf("__func__ is %s \n",__func__);
        printf("Debug: %s:%s():%d\n",__FILE__,__FUNCTION__,__LINE__);

## on x86-64bit host 

lake@localhost:~ $ gcc -dM -E  -m32  - < /dev/null | grep -i sizeof
#define __SIZEOF_FLOAT80__ 12
#define __SIZEOF_INT__ 4
#define __SIZEOF_POINTER__ 4
#define __SIZEOF_LONG__ 4

#define __SIZEOF_LONG_DOUBLE__ 12
#define __SIZEOF_SIZE_T__ 4
#define __SIZEOF_WINT_T__ 4
#define __SIZEOF_PTRDIFF_T__ 4
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_FLOAT128__ 16
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_WCHAR_T__ 4
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
lake@localhost$ gcc -dM -E    - </dev/null | grep -i sizeof
#define __SIZEOF_FLOAT80__ 16
#define __SIZEOF_INT__ 4
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_LONG__ 8
#define __SIZEOF_LONG_DOUBLE__ 16
#define __SIZEOF_SIZE_T__ 8
#define __SIZEOF_WINT_T__ 4
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_FLOAT128__ 16
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_INT128__ 16
#define __SIZEOF_WCHAR_T__ 4
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8

MinGW/Windows

gcc -posix -E -dM - < /dev/null

lhu@Windows10_64bit ~
$ gcc -posix -E -dM - < /dev/null |grep WIN
#define _WIN32 1
#define __WINT_MAX__ 0xffff
#define __WINT_MIN__ 0
#define __WIN32 1
#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define __SIZEOF_WINT_T__ 2
#define WIN32 1
#define __WINT_TYPE__ short unsigned int
#define WINNT 1

ARM 

arm-linux-gnueabihf-gcc  -posix -E -dM - < /dev/null 

Or

lake@localhost:~$ arm-linux-gnueabihf-gcc  -E -dM -c test.c >> marco_ARM-gnueabihf.txt

lake@localhost:~/tmp$ grep ARM     marco_ARM-gnueabihf.txt 
#define __ARMEL__ 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_PCS_VFP 1
#define __ARM_ARCH_7A__ 1
#define __ARM_EABI__ 1
#define __ARM_FEATURE_DSP 1

ubuntu16.04ros编译时报错home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:20:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 int cycle = 1; //巡航次数 ^ /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp: In member function ‘void Multipoint_Nav::move()’: /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:90:26: error: ‘goal’ does not name a type for(auto goal:pose) //遍历导航点列表 ^ In file included from /opt/ros/kinetic/include/ros/ros.h:40:0, from /opt/ros/kinetic/include/actionlib/client/simple_action_client.h:45, from /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:1: /opt/ros/kinetic/include/ros/console.h:373:3: error: expected ‘;’ before ‘do’ do \ ^ /opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macroROS_LOG_COND’ #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__) ^ /opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macroROS_LOG’ #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_ ^ /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:152:17: note: in expansion of macroROS_INFO’ ROS_INFO("------------------loop ( %d ) termination!----------- ^ /opt/ros/kinetic/include/ros/console.h:373:3: error: expected primary-expression before ‘do’ do \ ^ /opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macroROS_LOG_COND’ #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__) ^ /opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macroROS_LOG’ #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_
最新发布
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值