共 125 篇文章 |
|
实例2://test.cint fun(int a, int b){ return a+b;}//test.hint fun(int, int);//main.cpp#include <stdio.h>#include "test.h"int main(){ printf("%d\n", fun(10, 11)); return 0;}正确写法3//test.cint fun(int a, int b){ return a+b;}//test.hint fun(int, int);//main.cpp#include <... 阅11 转1 评0 公众公开 17-02-24 16:09 |
#ifdef __cplusplusextern "C" {#endif /*...*/ #ifdef __cplusplus}#endif.extern void print(int i);而且当指定一个函数指针的编译和连接方式时,函数的所有类型,包括函数名、函数引入的变量也按照指定的方式编译和连接。注意:typedef int (*FT) (const void* ,const void*),表示定义了一个函数指针的别名FT,这种函数指针指向... 阅18 转1 评0 公众公开 17-02-24 16:08 |
g_object_notify的使用方法。g_param_spec_boolean("modal", P_("Modal"), P_("if true, the window is modal( other windows are not usable while this one is up)"), FALSE, GTK_PARAM_READWRITE)g_object_notify(G_OBJECT(window), "modal");g_signal_connect(window, "notify::modal"... 阅1 转自开花结果 公众公开 17-02-16 20:43 |
g_signal_connect 与 g_signal_connect_swapped在 2.0 版,信号系统已从 GTK 移到 GLib,因此在函数和类型的说明中有前缀 "g_" 而不是 "gtk_"。拥有两个函数来设置信号连接的目的只是为了允许回调函数有不同数目的参数。GTK 库中许多函数仅接受一个单独的构件指针作为其参数,所以对于这些函数你要用 g_signal_connect_swa... 阅170 转0 评0 公众公开 17-02-16 20:36 |
g_signal_connect (window, "destroy", G_CALLBACK(gtk_main_quit), NULL);第 2 个参数 “destroy" 是一个 关闭窗口 的信号,可由点击标题栏上的 "关闭“ 按钮触发 或者可以显示的调用 gtk_widget_destroy() 函数来触发;第 3 个参数是当触发了 "destroy" 信号后会调用一个 gtk_main_quit() 的回调函数,可以理... 阅10707 转19 评0 公众公开 17-02-16 20:32 |
If allocator_traits::construct is not supported with the appropriate arguments for the element constructions, or if an invalid position or range is specified, it causes undefined behavior.If allocator_traits::construct is not supported with the appropriate arguments for the element constructions, or if value_type is n... 阅72 转0 评0 公众公开 16-09-29 11:06 |
C++智能指针(auto_ptr)详解智能指针(auto_ptr) 这个名字听起来很酷是不是?auto_ptr 是C++标准库提供的类模板,auto_ptr对象通过初始化指向由new创建的动态内存,它是这块内存的拥有者,一块内存不能同时被分给两个拥有者。1) 按值传递时,函数调用过程中在函数的作用域中会产生一个局部对象来接收传入的auto_ptr(拷贝构造),这样,传入的实参a... 阅44 转1 评0 公众公开 16-04-15 15:38 |
阅78 转2 评0 公众公开 16-03-17 16:05 |
很多时候在我们都不知道拷贝构造函数的情况下,传递对象给函数参数或者函数返回对象都能很好的进行,这是因为编译器会给我们自动产生一个拷贝构造函数,这就是“默认拷贝构造函数”,这个构造函数很简单,仅仅使用“老对象”的数据成员的值对“新对象”的数据成员一一进行赋值,它一般具有以下形式://是拷贝构造函数 X::X(X&, int=1)... 阅31 转0 评0 公众公开 16-03-16 17:38 |
C++中delete和delete[]的区别一直对C++中的delete和delete[]的区别不甚了解,今天遇到了,上网查了一下,得出了结论。C++告诉我们在回收用 new 分配的单个对象的内存空间的时候用 delete,回收用 new[] 分配的一组对象的内存空间的时候用 delete[]。delete p1;基本类型的对象没有析构函数,所以回收基本类型组成的数组空间用 delete 和 delete[... 阅25 转0 评0 公众公开 16-03-15 20:21 |