清单4中所示的结构由mimeokay函数使用,用来实现以下用途:将全局字符串指针fstr 设置为与文件扩展名fext 相匹配的合适的MIME类型。
The structure in Listing 4 is used by the mimeokay function for one purpose: to set the global string pointer fstr to the appropriate MIME type string matching the file's extension: fext.
与之相反的是,real_fchmod是一个由setup_ wrappers填充的函数指针。
By contrast, real_fchmod is a function pointer, which is populated by setup_wrappers .
当我们开始与库交流时,我们调用一个名为 newsession 的函数,它会返回一个空指针(这是组织事情的惯用方法)。
When we start talking to the library about something, we call a function called newsession that returns a void pointer (not an unusual way to organize things).
这样做的方法是,Perl对象包含一个只读的整数,此整数与函数newsession()返回的空指针相对应。
The way this is set up, the Perl object contains a read-only integer that corresponds to the void pointer returned by newsession().
很不幸,不可以将指针容器与标准库的可变算法共用。不过,这些算法中最有用的已经以成员函数的方式提供出来了。
Unfortunately it is not possible to use pointer containers with mutating algorithms from the standard library. However, the most useful ones are instead provided as member functions.
如果基类成员与派生类成员接受的实参不同,就没有办法通过基类类型的引用或指针调用派生类函数。
If the base member took different arguments than the derived-class member, there would be no way to call the derived function from a reference or pointer to the base type.
我们知道我们正在与指针打交道,有些新的函数是有意义的。例如,假设你想从动物园中删除一只动物。
Given that we know we are working with Pointers, a few new functions make sense. For example, say you want to remove an animal from the zoo.
如果你要使用这些适配器,它们的用法与标准的函数指针适配器是一样的。例如。
If you need to use these adapters, usage is identical to the standard function pointer adapters. For example.
函数指针传递好,只有转化为1印刷(这就是为什么警告与你打印它的行,而不是你通过行)。
The function pointer is passed fine, it's only converted to 1 for printing (which is why the warning relates to the line where you print it, not the line where you pass it).
函数指针传递好,只有转化为1印刷(这就是为什么警告与你打印它的行,而不是你通过行)。
The function pointer is passed fine, it's only converted to 1 for printing (which is why the warning relates to the line where you print it, not the line where you pass it).
应用推荐