小编Equ*_*ver的帖子

如何在makefile函数中传递逗号字符

在 Makefile 中定义了一个print函数,它将打印文本作为参数然后打印出来。我的问题是如何将逗号字符作为文本部分传递来打印它?例如,下面是相关的 makefile 部分,其中逗号不可打印。

print = echo '$(1)'

help:
        @$(call print, He lives in Paris, does not he?)
Run Code Online (Sandbox Code Playgroud)

现在,如果像这样运行 makefile:

$ make help 
Run Code Online (Sandbox Code Playgroud)

它打印

$  He lives in Paris
Run Code Online (Sandbox Code Playgroud)

代替

$  He lives in Paris, does not he?
Run Code Online (Sandbox Code Playgroud)

我知道在 makefile 中逗号用作单独的参数,但是如何使其可打印。我使用不同的转义字符组合将逗号作为文本消息传递,\, /, $$, ',' "," 但没有任何效果

shell makefile

6
推荐指数
1
解决办法
1128
查看次数

如何在C ++ 11中返回包含自定义删除器的std :: unique_ptr?

我的应用程序编译器最多只能支持c++11

下面是我的项目的代码,函数get_conn()返回std::unique_ptr自定义删除器(deleter需要两个参数)。我正在使用auto关键字作为返回类型,但是它给出了一个错误,例如if是否用c++11(用编译很好c++14

error: ‘get_conn’ function uses ‘auto’ type specifier without trailing return type
Run Code Online (Sandbox Code Playgroud)

示范代码示例:

#include <iostream>
#include <functional>
#include <memory>
using namespace std;


// Dummy definition of API calls                                                                                                             
int* open_conn (int handle)
{
  return new int;
}
void close_conn (int handle, int *conn)
{}

auto get_conn (int handle)
{
  // API call                                                                                                                                
  int* conn = open_conn (handle);    
  auto delete_conn = [](int *conn, int handle) {
        // API …
Run Code Online (Sandbox Code Playgroud)

c++ lambda return-type unique-ptr c++11

4
推荐指数
1
解决办法
142
查看次数

如何在gdb中打印寄存器地址?

我想打印寄存器自己的地址,它通过gdb驻留在内存中.例如,GPG寄存器r1驻留在内存中?从下面的结果我找不到寄存器自己的地址.

(gdb) info reg r0 r1
r0             0x0  0
r1             0x0  0
Run Code Online (Sandbox Code Playgroud)

即使

(gdb) x/x $r0
0x0 <_ftext>:   0xffffffff
(gdb) x/x $r1
0x0 <_ftext>:   0xffffffff
(gdb)
Run Code Online (Sandbox Code Playgroud)

gdb

2
推荐指数
1
解决办法
1758
查看次数

标签 统计

c++ ×1

c++11 ×1

gdb ×1

lambda ×1

makefile ×1

return-type ×1

shell ×1

unique-ptr ×1