gnu

What' s the difference between gnustl and stlport in android ndk development?

旧时模样 提交于 2019-12-21 03:46:30
问题 I want to know if their performance/stability differ from each other and their licenses explained in short. Real world experiences are welcomed. 回答1: As of yesterday (NDK r9d), gnustl was still more comprehensive, e.g. support for <thread>, <future>, and some other C++11 features. Even these depend on the toolchain: you could not use the default ARM gcc 4.6 to have them enabled. OTOH, stlport license is no-nonsense free, like the rest of AOSP, while the linking exception to GPL v3 for gnustl

Handling file paths cross platform

元气小坏坏 提交于 2019-12-21 03:34:10
问题 Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows and LInux. Our configuration files refer to another file in a seperate directory. I'd like to be able to read the path for the other configuration file into a class which would work on both Linux or Windows. Which class would offer the smallest footprint to translate paths to use on either system? Thanks 回答1: Unless you're using absolute paths, there's no need to translate at all -

How does grep work?

耗尽温柔 提交于 2019-12-20 17:37:12
问题 I am trying to understand how grep works. When I say grep "hello" *.* , does grep get 2 arguments — (1) string to be searched i.e. "hello" and (2) path *.* ? Or does the shell convert *.* into something that grep can understand? Where can I get source code of grep ? I came across this GNU grep link. One of the README files says its different from unix grep . How so? I want to look at source of FreeBSD version of grep and also Linux version of it (if they are different). 回答1: The shell does

How can I detect BSD vs. GNU version of date in shell script

僤鯓⒐⒋嵵緔 提交于 2019-12-20 10:27:23
问题 I am writing a shell script that needs to do some date string manipulation. The script should work across as many *nix variants as possible, so I need to handle situations where the machine might have the BSD or the GNU version of date. What would be the most elegant way to test for the OS type, so I can send the correct date flags? EDIT: To clarify, my goal is to use date's relative date calculation tools which seem distinct in BSD and GNU. BSD example date -v -1d GNU example date --date="1

GNU date and custom formats

岁酱吖の 提交于 2019-12-20 06:24:40
问题 I have some strings in a specific date format that I'd like to work on using the GNU date command (coreutils 8.20). I can get date to output using the +FORMAT string, but not to understand strings input into it using the same string. I'm quite sure I'm missing something obvious. What gives? teggl@mckinley { ~/scripts }$ date +%Y%m%dT%H%M%S 20131202T182052 teggl@mckinley { ~/scripts }$ date --date="20131202T182052" +%Y%m%dT%H%M%S date: invalid date ‘20131202T182052’ Note: I'm not looking for

Are “Statement and Declarations in Expressions” specific to GNU C?

时光总嘲笑我的痴心妄想 提交于 2019-12-20 04:16:21
问题 Are Statement and Declarations in Expressions specific to GNU C ? Or this feature is also included in C99 standard ? 回答1: It's a GCC extension. (See the GCC docs, e.g. here for gcc 4.3.3, for a full list of GCC extensions; and the C99 spec is available here.) GCC will warn about such things if you use the -pedantic -std=c99 flags, e.g.: $ cat foo.c int main(void) { return ({ int a = 0; a; }); } $ gcc -pedantic -std=c99 -c foo.c foo.c: In function 'main': foo.c:3: warning: ISO C forbids braced

Intel compiler (C++) issue with OpenMP reduction on std::vector

╄→尐↘猪︶ㄣ 提交于 2019-12-19 19:51:54
问题 Since OpenMP 4.0, user-defined reduction is supported. So I defined the reduction on std::vector in C++ exactly from here. It works fine with GNU/5.4.0 and GNU/6.4.0, but it returns random values for the reduction with intel/2018.1.163. This is the example: #include <iostream> #include <vector> #include <algorithm> #include "omp.h" #pragma omp declare reduction(vec_double_plus : std::vector<double> : \ std::transform(omp_out.begin(), omp_out.end(), omp_in.begin(), omp_out.begin(), std::plus

Non-greedy matching with grep

瘦欲@ 提交于 2019-12-19 17:38:09
问题 Non greedy matching as far as I know is not part of Basic Regular Expression (BRE) and Extended Regular Expression (ERE). However, the behaviour on different versions of grep (BSD and GNU) seems to suggest other wise. For example, let's take the following example. I have a string say: string="hello_my_dear_polo" Using GNU grep : Following are few attempts to extract hello from the string. BRE Attempt (fails) : $ grep -o "hel.*\?o" <<< "$string" hello_my_dear_polo Output yields entire string

g ++和gcc有什么区别?

為{幸葍}努か 提交于 2019-12-19 16:17:50
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> g ++和gcc有什么区别? 哪些应该用于一般的c ++开发? #1楼 “GCC”是GNU Compiler Collection的常用简写术语。 这是编译器的最通用名称,以及强调编译C程序时使用的名称(缩写以前代表“GNU C编译器”)。 在引用C ++编译时,通常调用编译器“G ++”。 由于只有一个编译器,无论语言环境如何,将其称为“GCC”也是准确的; 但是,当重点是编译C ++程序时,术语“G ++”更有用。 你可以 在这里 阅读更多。 #2楼 gcc 和 g++ 是GNU Compiler Collection的 编译器驱动程序(曾经只是GNU C编译器 )。 即使它们根据文件类型自动确定调用哪些后端( cc1 cc1plus ...),除非用 -x language 覆盖,否则它们会有一些差异。 默认情况下可能最重要的区别是它们自动链接的库。 根据GCC的在线文档 链接选项 以及 如何调用 g++ , g++ 等同于 gcc -xc++ -lstdc++ -shared-libgcc (第一个是编译器选项,第二个是链接器选项)。 这可以通过使用 -v 选项运行来检查(它显示正在运行的后端工具链命令)。 #3楼 对于c ++,你应该使用g ++。 它是相同的编译器(例如GNU编译器集合)。

tr command - how to replace the string “\n” with an actual newline (\n)

蹲街弑〆低调 提交于 2019-12-18 13:53:09
问题 I would like to use the tr command to replace all occurrences of the string "\n" with a new line (\n). I tried tr '\\n' '\n' but this just seems to match any '\' and any 'n' 回答1: Here's how to do it with sed : sed 's/\\n/\n/g' Example usage: To replace all occurrences of \n in a file in-place: sed -i 's/\\n/\n/g' input_filename To replace all occurrences of \n through a pipe, and save into another file cat file1 file2 file3 file4 | sed 's/\\n/\n/g' > output_file 来源: https://stackoverflow.com