可能重复:
我见过很多这样的用法,以前我认为程序员想要轻易地突破一个代码块。为什么这里需要一个do {.} while (0)循环?我们是想告诉编译器什么吗?
例如,在Linux内核2.6.25中,包含/asm-ia64/system.h
/*
* - clearing psr.i is implicitly serialized (visible by next insn)
* - setting psr.i requires data serialization
* - we need a stop-bit before reading PSR because we som
我有一个非常大的DO文件,我需要控制代码是在Linux还是Windows中运行。 为此,我想我应该在文件的顶部添加这段代码: // Set OS variable for filesystem/directory control: values are: {linux, win}
local os = "linux" 然后,每当我必须选择正确的文件系统的目录输出时,我都会得到: if "`os'" == "linux" {
use "/mnt/DataResearch/DataStageData/CV_PATIENT_L
我试图在Debian /Linux稳定系统上编译一些较旧的C++代码(可能来自2001-2002年)。在编译时,我得到以下错误:
In file included from /usr/include/c++/4.7/vector:66:0,
from ../FooMath/FooBar.h:23,
from FooBar.cpp:2:
/usr/include/c++/4.7/bits/stl_bvector.h: In member function ‘std::vector<bool, _Alloc>::siz
在此之前,我收到了来自gcc -std=c99的警告,usleep()是隐式声明的。然后我偶然发现了,这导致我使用了-D_BSD_SOURCE。然而,现在gcc告诉我,-D_BSD_SOURCE已经被废弃了,我应该使用-D_DEFAULT_SOURCE。
#warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
为什么不推荐-D_BSD_SOURCE?为什么要使用-D_DEFAULT_SOURCE呢?那它是做什么的?
我做了,结果只有很多人用它来关闭gcc。我不知道为什么反对-D_BS
我在cmake中编写了一个实用工具宏,用于设置依赖于平台的变量。理论上应该很简单,但我不知道为什么我的变量没有被设定。以下是宏:
macro(SetCrossPlatform name msvc_val linux_val macos_val)
#macro(SetCrossPlatform VAR name MSVC msvc_val LINUX linux_val MACOS macos_val) # alternative signature that I tried
MESSAGE(STATUS "PLATFORM ${PLATFORM}")
if (
我不明白为什么下面的if语句的结果总是不正确:
unsigned long is_linux;
printf("plz. enter a digit : ");
gets(str);
sscanf(str,"%d",&is_linux);
printf("the value of is_linux = %d \n",is_linux);
if(is_linux==1)
printf("Here is 1 ! \n");
else
printf("There is 0 ! \n");
我只
请帮个忙。我正在尝试创建这个lisp宏,它接受一个(数字)列表作为输入,并返回这些数字的总和。代码
(setf g (list 1 2 3 4))
(defmacro add-test(var)
`(+ ,@var))
(add-test g)给出此错误
The value G is not of type LIST.
[Condition of type TYPE-ERROR]
同时,(add-test (1 2 3 4))给出了正确的结果,即10。
你能解释一下,当变量被传递给函数时,为什么它不起作用?
其他细节-
Lispbox - SBCL
Ubuntu Linux
提前感谢
我正在尝试将一个项目从一个旧的linux平台转移到kubunutu 9.04。现在,在用gcc 4.3.3编译时,我得到了这个错误:
/usr/src/linux-headers-2.6.28-11-generic/include/linux/cpumask.h:600:37: error: "and" may not appear in macro parameter list
如果我正确理解消息,则不允许将"and“用作宏参数,因为它是”保留命令“。关于这一点,有两个问题:
这怎麽可能?我无法想象linux头文件中会有这样的错误.我以前做错什么了吗?我试过了#u
我是在Linux (GCC 4.4.2)和Windows C++速成版2008下编译的
我目前正在Windows XP Pro 32位下编译,并已将此添加到我的源代码中。
#if defined( WIN32 )
/* Do windows stuff here */
#endif
但是,if语句中的代码被禁用(灰显)。但是,如果我执行以下操作:
#if defined( _MSC_VER )
/* Do windows stuff here */
#endif
if语句代码已启用。
我只是想知道,我应该使用什么。我见过很多程序员使用WIN32。然而,这似乎对我不起作用。我应该改用_MSC_V