Forgive me if this is a dumb question. It seems like such a simple thing
that I shouldn't have to ask, but alas, I can't seem to figure it out.
I'm porting some C++ code to MC++ and I have a function that formerly
returned either a valid pointer, or NULL. In MC++, how do I return NULL?
If I try "return NULL;" I get a "cannot convert from 'int' to ..." error.
Thanks,
--Jeremy 5 7831
>I'm porting some C++ code to MC++ and I have a function that formerly
>returned either a valid pointer, or NULL. In MC++, how do I return NULL? If I try "return NULL;" I get a "cannot convert from 'int' to ..." error.
Jeremy,
Is nullptr perhaps what you're looking for?
Dave
I'm porting some C++ code to MC++ and I have a function that formerly
>>returned either a valid pointer, or NULL. In MC++, how do I return NULL? If I try "return NULL;" I get a "cannot convert from 'int' to ..." error.
Is nullptr perhaps what you're looking for?
nullptr is a VC2005 thing that doesn't exist in VC2003.
If the op uses C++/CLI, nullptr will work. With MC++ it won't.
With VC2003 you can use NULL.
e.g. this compiles without problem:
System::String *s = NULL;
OP: What is the function prototype?
--
Kind regards,
Bruno van Dooren br**********************@hotmail.com
Remove only "_nos_pam"
nullptr did it. Thanks. You would think that that would have been easy
to find. I guess I just looked in all of the wrong places. Thanks,
--Jeremy
David Lowndes wrote:
>I'm porting some C++ code to MC++ and I have a function that formerly returned either a valid pointer, or NULL. In MC++, how do I return NULL? If I try "return NULL;" I get a "cannot convert from 'int' to ..." error.
Jeremy,
Is nullptr perhaps what you're looking for?
Dave
nullptr did it. Thanks. You would think that that would have been easy
to find. I guess I just looked in all of the wrong places. Thanks,
--Jeremy
Hi,
just for future reference: if you use .NET with Visual C++ 2005, you are
using C++/CLI.
with VC2003 it is called 'Managed Extensions for C++', 'Managed C++' or
simply 'MC++'
these are completely incompatible, so if you are searching for information,
be sure to use the correct name or you'll find lots of information that are
of no use to you anymore.
--
Kind regards,
Bruno van Dooren br**********************@hotmail.com
Remove only "_nos_pam"
Good to know. I had been searching with "MC++" and then translating old
syntax to new syntax. I'll use C++/CLI instead.
Thanks,
--Jeremy
Bruno van Dooren [MVP VC++] wrote:
>nullptr did it. Thanks. You would think that that would have been easy to find. I guess I just looked in all of the wrong places. Thanks, --Jeremy
Hi,
just for future reference: if you use .NET with Visual C++ 2005, you are
using C++/CLI.
with VC2003 it is called 'Managed Extensions for C++', 'Managed C++' or
simply 'MC++'
these are completely incompatible, so if you are searching for information,
be sure to use the correct name or you'll find lots of information that are
of no use to you anymore. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Bailo |
last post by:
The c# *return* statement has been bothering me the past few months.
I don't like the fact that you can have different code paths in a method
and have multiple return statements. To me, it...
|
by: Gama Franco |
last post by:
Hi,
I'm designing an interface for a shared library, and I would like to
know if there is a standard about how to return an object to the user. I
will use exceptions to report errors, so there...
|
by: Michael |
last post by:
Ok,
When can i return by reference? For the sake of simplicity:
lets say I have a class MLine:
class mv3
{
public:
float x,y,z;
|
by: b_naick |
last post by:
I have a class file in my ASP .NET C# application - defined as follows:
namespace ABC {
public class BizObj {
public Style GetVal(int id) {
Style temp = new Style();
// run some db queries...
|
by: weston |
last post by:
I've got a piece of code where, for all the world, it looks like this
fails in IE 6:
hometab = document.getElementById('hometab');
but this succeeds:
hometabemt =...
|
by: gregory_may |
last post by:
Is it possible to return "nothing" from an Integer function? This seems to
give me "0" rather than "nothing".
Private Function MyFunction() As Integer
Return Nothing
End Function
|
by: Jim Langston |
last post by:
I'm sure this has been asked a few times, but I'm still not sure.
I want to create a function to simplify getting a reference to a CMap in a
map.
This is what I do now in code:
...
|
by: joey.powell |
last post by:
Hello,
I have a windows forms application (VS2005) where I need to do the
following...
1. Startup with a main form.
2. Have the user to select a file and then bring up a second form
modally...
|
by: |
last post by:
The output is:
1234
After getline: 1234
After renew: 1234
After retnp: İİİİİİİİİİİİİİİİG
After getp: İİİİİİİİİİİİİİİİG
-----What happen after renew/retnp call?-------
Why not return a true...
|
by: Jim Langston |
last post by:
I remember there was a thread a while back that was talking about using the
return value of a function as a reference where I had thought the reference
would become invalidated because it was a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
| |