小编u14*_*796的帖子

没有libc编译

我想在没有(g)libc的情况下编译我的C代码.如何停用它以及哪些功能依赖于它?

我尝试了-nostdlib但它没有帮助:代码是可编译的并运行,但我仍然可以在我的可执行文件的hexdump中找到libc的名称.

c gcc glibc libc demo

53
推荐指数
2
解决办法
3万
查看次数

任意尺寸的无限体积的交点

我需要代码/文本/谷歌关键字/其他资源来实现这个类.速度无关紧要.它应该适用于任何数量的维度.

class InfiniteVolume: # such as a point, line, plane, volume, 4d-volume
    def __init__(self, points): # two points for line, three points for plane, etc.
        self.points = points
        assert all(len(p)==len(points[0]) for p in points)

    def vdim(self): # Dimensions of the volume. For example 2.
        return len(self.points)-1

    def wdim(self): # Dimensions of the world.  For example 3.
        return len(self.points[0])

    def __contains__(self, point):
        # ???

    def intersect(self, other):
        assert self.wdim() == other.wdim()
        # ???
Run Code Online (Sandbox Code Playgroud)

python math intersection multidimensional-array

3
推荐指数
1
解决办法
580
查看次数

C中的快速dictonary没有线性搜索

如何在没有线性搜索的情况下在C中制作快速的dictonary(String => Pointer和Int => Pointer)?我需要一些(或更多)代码行,而不是库,并且必须可以在闭源软件(LGPL,...)中使用它.

c dictionary data-structures

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

Windows和Linux上的相同二进制代码(x86)

我想将一堆C++文件编译成原始机器代码并使用C语言编写的依赖于平台的启动器运行它.(类似于fread(缓冲区,1,len,文件); a =((*int(*) (int))缓冲区)(b);)

如何告诉g ++输出原始代码?

函数调用会起作用吗?我怎样才能使它工作?

我认为linux和windows的调用约定有所不同.这是一个问题吗?我该如何解决?

编辑:我知道PE和ELF阻止DIRECT启动可执行文件.但这就是我的首发.

c++ linker g++

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

GCC:数组类型有不完整的元素类型?

当我尝试编译时,GCC给了我一个"数组类型有不完整的元素类型"-error消息:

typedef struct _node node;
struct _node{
 int foo;
 node (*children)[2];
 int bar;
};
Run Code Online (Sandbox Code Playgroud)

在内存中,结构应该如下所示

0x345345000000 foo
0x345345000004 pointer to 1. child node
0x345345000008 pointer to 2. child node
0x34534500000C bar
Run Code Online (Sandbox Code Playgroud)

arrays gcc struct pointers typedef

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