Hello,
I'd like to know, whether it is possible to have type information associated with "null". I am implementing a wrapper (MC++) for our legacy method that accepts variable number of arguments and I need to distinguish types of passed parameters, which can have "null" values:
int Wrapper::Call(S tring *method, [ParamArray] System::Object *args[])
{
// ...
// args[i] can be null
for(int i = 0, nCount = args->Count; i < nCount; i++)
{
if(__typeof(... )->Equals(args[i]->GetType()))
// Do something for the first type
else
if(__typeof(... )->Equals(args[i]->GetType()))
// Do something else for the second type
...
}
}
It would be nice to allow calls like this (e.g. from C#):
wrapper.Call("M ethod", 10, (TypeA)null, objB, (TypeC)null, 7); 2 1255
Stanislav Simicek wrote: I'd like to know, whether it is possible to have type information associated with "null". I am implementing a wrapper (MC++) for our legacy method that accepts variable number of arguments and I need to distinguish types of passed parameters, which can have "null" values:
[SNIP]
It would be nice to allow calls like this (e.g. from C#):
wrapper.Call("M ethod", 10, (TypeA)null, objB, (TypeC)null, 7);
It is not possible to pass type information along with the null value, but
it is possible to statically give a type to the null value expression. In
fact, that is exactly what you did. The only benefit of that is to influence
overload resolution. So in the example above, the type information TypeA and
TypeC only affect which method gets called. You'll end up with an Object
array having two null values.
--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
> It is not possible to pass type information along with the null value,
Ok, thanks for the info. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rachel Weeden |
last post by:
I'm working on an ASP Web application, and am having syntax issues in
a WHERE statement I'm trying to write that uses the CInt Function on a
field.
Basically, I want to select records using criteria of Race, Gender and
Crime Code. But the Crime Code field in the table is text, and I
cannot change it. I want to use a range of crime codes, so need to
convert it to an integer on-the-fly. Here's what I have in my code so
far:
|
by: DraguVaso |
last post by:
Hi,
Something I don't understand about a Typed DataSet: When a value in the
DataSet is DBNull, it throws this error: "Cannot get value because it is
DBNull".
But aren't Typed DataSets invented to make life easier, to be able to get to
tge Tables and Values with less code, in less time? But with this thing you
need to add a Try-Catch around every statement when using the value, add for
each value a default value in your DataSet (and...
|
by: James A. Donald |
last post by:
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified to read
"no variable or argument declarations are necessary."
Surely that means that if I misspell a variable name, my program will
mysteriously fail to work with no error message.
If you don't declare variables, you can inadvertently re-use an
variable used in an enclosing context when you don't intend to, or
|
by: Susie Swint |
last post by:
I have the following IIf statement which worked in Access 95 but will
not work in Access 2002. The error message I get is that the expression
is typed incorrectly, or is too complex to be evaluated. Can you tell
me what is wrong with the statement?
Audits: IIf(. Is Not Null,.,IIf(. Is Not Null,.,IIf. Is Not Null,.,IIf(. Is Not Null,.,0))))
Thanks!
|
by: John Chorlton |
last post by:
I've been attempting to pass a chunk of data back from a child Windows form using public properties on the form and have been getting some odd errors. I wanted to return a row of data to avoid creating many public properties on the form to do the same thing. At first I tried returning a DataViewRow. This worked fine until I reached the phone field on the parent table and the code
Child form
public DataRowView SelectedAddres
ge
...
| |
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic paper written on this
subject.
On the Expressive Power of Programming Languages, by Matthias
Felleisen, 1990.
http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
|
by: jht5945 |
last post by:
For example I wrote a function:
function Func()
{
// do something
}
we can call it like:
var obj = new Func(); // call it as a constructor
or
var result = Func(); // call it as a function
|
by: mcbobin |
last post by:
Hi,
Here's hoping someone can help...
I'm using a stored procedure to return a single row of data ie a
DataRow
e.g.
public static DataRow GetManualDailySplits(string prmLocationID, string
|
by: hadad.yaniv |
last post by:
Hello,
i am new to c++,
i hav a vector of typed object:
vector<Man*People;
When i do a second pushback, even for the same object the program
crash say:
"An Access Violation (Segmentation fault) raised in your program"
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |