function-pointers

    54热度

    4回答

    为什么取消引用函数指针只是“什么都不做”? 这就是我所说的: #include<stdio.h> void hello() { printf("hello"); } int main(void) { (*****hello)(); } 从评论上here: 函数指针提领只是 罚款,但由此产生的功能 标志将立即 转换回函数指针 而且从一个答案here: 解引用(在方式,您觉得)

    1热度

    2回答

    我有以下情形: Class_A - method_U - method_V - method_X - method_Y Class_B - method_M - method_N HttpClass - startRequest - didReceiveResponse // is a callback 现

    1热度

    1回答

    我目前正在编写嵌入python解释器的应用程序。这个想法是让程序在程序中的特定事件上调用用户指定的脚本。我管理这部分,但现在我希望脚本能够在我的程序中调用函数。 这里是我到目前为止的代码: #include "python.h" static PyObject* myTest(PyObject* self,PyObject *args) { return Py_BuildValu

    2热度

    6回答

    在我正在开发的嵌入式系统中,我们使用了一个函数指针表来支持专有的动态库。 我们有一个使用命名常量(#define)作为函数指针索引的头文件。这些值用于计算函数地址表中的位置。 实施例: (export_table.c) // Assume each function in the table has an associated declaration typedef void (*Functio

    0热度

    2回答

    我有一个模板化的SpecialisedRedBlackTree类。 我的月课不是。 在我Month类我有一个私有成员是SpecialisedRedBlackTree的一个实例: SpecialisedRedBlackTree<Day> m_windSpeedTree; 正如你可以看到它会采取Day类/对象(请纠正我在任何方面,我拿错) 。 在我Month类,我传递的方法函数指针,这个方法的方法

    1热度

    4回答

    对于这个代码:我的机器上 #include<stdio.h> void hello() { printf("hello\n"); } void bye() { printf("bye\n"); } int main() { printf("%p\n", hello); printf("%p\n", bye); return 0; } 输出: 0x804

    6热度

    1回答

    我试图创建一个函数指针,它将一个函数指针作为参数,但我不知道该如何去做......我被建议尝试键入我的函数指针之一,但得到相同的错误。有人可以用正确的语法来帮助我吗? int 186 main(int argc, char **argv) 187 { 188 int i; 194 typedef int (*search_alg) (int *, int, int); 195 t

    0热度

    2回答

    指针这是从Mac上学习Objective-C的一个问题... 函数的指针 我输入什么,按配方,是: NSString *boolString (BOOL yesNo) { if (yesNo) { return (@"YES"); } else { return (@"NO"); } } // boolString 第一行中的指针星号似乎并不必要,但删除它会导致出现错误消息。但它有什么作

    0热度

    2回答

    我有几个C脚本,它们都具有相同的格式(函数),但偶尔会有几个函数中的实际代码。我想一个功能分离到外部的头文件,但问题是这样的: int FunctionImExtracting() { //some code FunctionThatCannotBeExtractedButTheFunctionSignatureWillAlwaysRemainTheSame() /

    23热度

    1回答

    如何将托管C++(C++/CLI)的函数指针传递给非托管方法?我读了几篇文章,如this one from MSDN,但它描述了两个不同的程序集,而我只需要一个。 这是我的代码: 1)报头(MyInterop.ManagedCppLib.h): #pragma once using namespace System; namespace MyInterop { namespace Mana