可以检查一个函数的返回类型? [英] Possible to check return type of a function?

查看:133
本文介绍了可以检查一个函数的返回类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说我有一个功能..

Let's say I have a function..

无效*的getValue(...);

void * getValue(...);

有没有办法,我查了通话来的getValue(...)?

Is there a way that I check for the return type of a call to getValue(...) ?

我打算用一个程序一个void *方法如的getValue()和我的程序的进程将取决于的getValue的返回类型()。

I plan on using a void* method such as getValue() in a program and the process of my program will be dependent on the return type of getValue().

是否有可能检查返回类型?

Is it possible to check for return type?

推荐答案

您可能要返回一个结构,而不是

You may want to return a structure instead

enum valuetype {PCHAR, PSHORT, PINT, PLONG, PLLONG, PFLOAT, PDOUBLE, PLDOUBLE};
struct sometype {
    enum valuetype vt;
    void *value;
}
struct sometype getValue(...);

这篇关于可以检查一个函数的返回类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆