gnu

what does the weak_alias function do and where is it defined

老子叫甜甜 提交于 2019-12-08 15:30:30
问题 So I'm looking through the source of gcc compiler and I've come along this in fork.c: int __fork () { __set_errno (ENOSYS); return -1; } libc_hidden_def (__fork) stub_warning (fork) weak_alias (__fork, fork) #include <stub-tag.h> I'm trying to figure out what weak_alias does. I've used the grep command inside the glibc source files to find all occurrences of #define weak_alias: grep -r "#define weak_alias" I've found many occurrences of the macro: #define weak_alias(n, a) but the macros don't

ubuntu14.04编译gnu global 6.6.3

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 14:27:29
打算重新折腾下环境,看中了gtags ,可参考 Vim 8 中 C/C++ 符号索引:GTags 篇 ,先记录下编译过程 源码 下载并解压源码 最新的代码到官方下载页面获取  https://www.gnu.org/software/global/download.html 例如我下载的是 wgets http://tamacom.com/global/global-6.6.3.tar.gz 下载后解压并进入目录 依赖 先安装依赖 sudo apt-get build-dep global sudo apt-get install libncurses5-dev libncursesw5-dev 配置 再配置,配置的时候可以使用--prefix指定安装目录,考虑到我后续需要在无sudo权限的机器上使用,这里执行安装到用户目录下的usr ./configure --prefix=/home/zhuangqiubin/usr 编译 直接调用make即可 make 本以为make会很顺利,没想到出来一个报错 find.c: In function ‘findassign’: find.c:557:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; opts[i] !=

How do I pass a quoted string with -D to gcc in cmd.exe?

浪子不回头ぞ 提交于 2019-12-08 14:14:20
With gcc (and possibly other compilers as well) it's possible to define a macro outside the source file like so: c:\MinGW\bin\gcc.exe -DDEFINED_INT=45 foo.c -o foo.exe This will define DEFINED_INT to 45 which can be seen when compiling #include <stdio.h> int main() { printf("The define was: %d\n", DEFINED_INT); return 0; } The compiled foo.exe will then print 45 when executed. Now, what I have no clue of is how do I pass a quoted string instead of an int. So, the printf would then be something like printf("The define was: %s\n", DEFINED_STRING); and the compilation like so: c:\MinGW\bin\gcc

Checking whether or not a logical sequence that has assumptions in it is valid

这一生的挚爱 提交于 2019-12-08 12:33:06
问题 Alright I'm writing a program to read a bunch of text files containing logical sequences such as: [and(p,q), and(r,s)]. and(p,s). [ [1, and(p,q), premise], [2, and(r,s), premise], [3, p, andel1(1)], [4, s, andel2(2)], [5, and(p,s), andint(3,4)] ]. And then check if the proof is valid or not. So far so good, I've written all predicates I can think of for rules that don't include assumptions, and it works. Here is the code so far: verify(InputFileName) :- see(InputFileName), read(Prems), read

How to use mcheck for Heap Consistency Check in GNU C?

拥有回忆 提交于 2019-12-08 10:39:52
问题 I am trying to understand how heap consistency checking works in GNU C Library. I Refered http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html#Heap-Consistency-Checking Here is a sample program I have written. I expected as suggested in the manual if I run in gdb and call mcheck(0) my custom abortfn would be called. But it isn't getting called. What am I missing here? included necessary headers. void *abortfn(enum mcheck_status status) { switch(status) { case

How to check that c99 is used, and not gnu99

十年热恋 提交于 2019-12-08 07:06:48
问题 I want to add a warning message during the compilation to warn the user it should use gnu99 instead of c99 (I am using anonymous struct, and it seems it doesn't exist at all in c99). I found that: #if __STDC_VERSION__ >= 199901L but this test is true for c99 and gnu99. Which predefined macro could I use? 回答1: You can check for yourself: $ gcc -std=c99 -dM -E - < /dev/null > c99.txt $ gcc -std=gnu99 -dM -E - < /dev/null > gnu99.txt $ sdiff -s c99.txt gnu99.txt #define __STRICT_ANSI__ 1 < 来源:

Standard C++ libraries headers on gnu gcc site

*爱你&永不变心* 提交于 2019-12-08 06:32:02
问题 I want to browse the source code of gnu implementation of C++ standard libraries -- header files as well as the implementation. I have landed myself into: http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/index.html My first step was to look header file at: http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a01376.html My question is that as per my understanding the typedeffed string sth like: typedef basic_string string; should have been present in string header,

Why is field separator taken into account differently if set before or after the expression?

霸气de小男生 提交于 2019-12-08 05:23:34
问题 The code print split("foo:bar", a) returns how many slices did split() when trying to cut based on the field separator. Since the default field separator is the space and there is none in "foo:bar", the result is 1: $ awk 'BEGIN{print split("foo:bar",a)}' 1 However, if the field separator is ":" then the result is obviously 2 ("foo" and "bar"): $ awk 'BEGIN{FS=":"; print split("foo:bar", a)}' 2 $ awk -F: 'BEGIN{print split("foo:bar", a)}' 2 However, it does not if FS is defined after the Awk

solving equation using octave

流过昼夜 提交于 2019-12-08 03:56:18
问题 I have a simple equation I'm trying to solve num1=-2 num2=-3 x+num2=num1 x+-3=-2 x=1 How can I do this in octave. In matlab I can do y = solve('x-3 = -2') but this doesn't work in octave 3.8.1 which is the version I'm using . How can I get octave to solve these types of equations? I'm interested in the numeric value for a solution. 回答1: I'm assuming that the equation in your question is an example. If you're interested in a numeric solution, there is often no need to use symbolic math. In

compiling c++ code using gnu/c getline() on mac osx?

余生颓废 提交于 2019-12-08 01:32:36
问题 I'm trying to compile a pre-existing c++ package on my mac osx leopard machine, and get the following error: error: no matching function for call to 'getline(char**, size_t*, FILE*&)' This is probably because getline() is a GNU specific extension. Can I somehow make the osx default g++ compiler recognize such GNU specific extensions? (if not, I could always supply my own implementation or GNUs original one, but I prefer to have a "cleaner" solution if possible) 回答1: getline is defined in