473,785 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return type

Hi,

How can i specify the return type of a function returning a managed array of chars.
If i try to write: "char __gc[] func()" i get an error!

How can i do that?

Thanks!
Nov 17 '05 #1
31 2626
> How can i specify the return type of a function returning a managed array of chars.
If i try to write: "char __gc[] func()" i get an error!

char func() __gc[]

have a look at:

http://groups.google.com/groups?hl=e...6btnG%3DSearch
or http://shrinkster.com/dm
--
Ben
http://bschwehn.de
Nov 17 '05 #2
Ok, thanks!
But that is really strange...

Ben Schwehn <b.*******@gmx. net> wrote in message news:<uX******* *******@TK2MSFT NGP15.phx.gbl>. ..
How can i specify the return type of a function returning a managed array of chars.
If i try to write: "char __gc[] func()" i get an error!

char func() __gc[]

have a look at:

http://groups.google.com/groups?hl=e...6btnG%3DSearch
or http://shrinkster.com/dm

Nov 17 '05 #3
Ok, thanks!
But that is really strange...

Ben Schwehn <b.*******@gmx. net> wrote in message news:<uX******* *******@TK2MSFT NGP15.phx.gbl>. ..
How can i specify the return type of a function returning a managed array of chars.
If i try to write: "char __gc[] func()" i get an error!

char func() __gc[]

have a look at:

http://groups.google.com/groups?hl=e...6btnG%3DSearch
or http://shrinkster.com/dm

Nov 17 '05 #4
CeZar,
Ok, thanks!
But that is really strange...


You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #5
CeZar,
Ok, thanks!
But that is really strange...


You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #6
Hi,

Tomas, can you please explain how the compiler works here.
Sounds interesting...

By the way, I'm learning Managed extensions for C++, and it's very powerfull.

Thanks!

"Tomas Restrepo \(MVP\)" <to****@mvps.or g> wrote in message news:<uA******* *******@TK2MSFT NGP10.phx.gbl>. ..
CeZar,
Ok, thanks!
But that is really strange...


You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....

Nov 17 '05 #7
Hi,

Tomas, can you please explain how the compiler works here.
Sounds interesting...

By the way, I'm learning Managed extensions for C++, and it's very powerfull.

Thanks!

"Tomas Restrepo \(MVP\)" <to****@mvps.or g> wrote in message news:<uA******* *******@TK2MSFT NGP10.phx.gbl>. ..
CeZar,
Ok, thanks!
But that is really strange...


You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....

Nov 17 '05 #8
Tomas Restrepo (MVP) wrote:
CeZar,

Ok, thanks!
But that is really strange...

You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....

I can't understand how this crap makes sense from the C++ grammar point
of view. May you expand on that?
Also I hope this will not make into C++/CLI.
The one that would make sense is __gc char* func(), but given the
current managed extensions the one the OP mentioned:
char __gc[] func()


Best regards,

Ioannis Vranos
Nov 17 '05 #9
Tomas Restrepo (MVP) wrote:
CeZar,

Ok, thanks!
But that is really strange...

You are right it looks completely bizarre... you're not the first to be
surprised by it! :)
It does make sense if you look at it from the point of view of the compiler
and the C++ grammar, though....

I can't understand how this crap makes sense from the C++ grammar point
of view. May you expand on that?
Also I hope this will not make into C++/CLI.
The one that would make sense is __gc char* func(), but given the
current managed extensions the one the OP mentioned:
char __gc[] func()


Best regards,

Ioannis Vranos
Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3081
by: DaKoadMunky | last post by:
Please consider the following... <CODE> #include <string> using namespace std; typedef int PrimitiveType; typedef string ClassType;
6
3440
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So now I'm trying an XmlTextWriter instead. I whipped-up another webservice based on this: http://www.codeproject.com/aspnet/RSSviaXmlTextWriter.asp?print=true This example isn't set up strictly as a webservice. It seems to output to an aspx...
10
2620
by: LaEisem | last post by:
On-the-job, I have "inherited" a lot of old C language software. A question or two about when "casting" of null pointer constants is needed has occurred during behind-the-scenes cleanup of some of that software. That subject seems not to be addressed, at least not directly, in the C FAQ where FAQ 5.2 seems most relevant. References: * C FAQ 5.2 Null pointers (Including conditions where "casting" of null pointer...
59
3464
by: Michael C | last post by:
eg void DoIt() { int i = FromString("1"); double d = FromString("1.1"); } int FromString(string SomeValue) {
3
4615
by: C++ | last post by:
According to Thinking in C++ "You cannot modify the return type of a virtual function during overriding.but there is a special case in which you can slightly modify the return type. If you¡¯re returning a pointer or a reference to a base class, then the overridden version of the function may return a pointer or reference to a class derived from what the base returns." And here's the example: class PetFood {
3
4552
by: kikazaru | last post by:
Is it possible to return covariant types for virtual methods inherited from a base class using virtual inheritance? I've constructed an example below, which has the following structure: Shape = base class Triangle, Square = classes derived from Shape Prism = class derived from Shape TriangularPrism, SquarePrism = classes derived from Triangle and Prism, or Square and Prism respectively
9
4010
by: Alexander Widera | last post by:
hi, is it possible to return an object of an unknown (but not really unknown) type with an method? i have the following situation: - a variable (A) of the type "object" which contains the object - a variable (B) of the type "Type" which contains the type of the object in (A) (A should be of the type B) - a method which should return the object (A) as type (B)
9
4787
by: hufaunder | last post by:
I have a class "TestSuper" that implements the interface "TestBase". The interface has a property of type "ReturnType". The class "TestSuper" does not return "ReturnType" but a derivation "ReturnSuper". This gives the following compile error due to a bad return type: TestSuper does not implement interface member TestBase.Func. TestSuper.Func is either static, not public, or has the wrong return type.
14
2037
by: =?Utf-8?B?QmVu?= | last post by:
Hi all, I'm trying to understand the concept of returning functions from the enclosing functions. This idea is new to me and I don't understand when and why I would need to use it. Can someone please shed some light on this subject? Thanks a lot, Ben
4
2032
by: fabian.lim | last post by:
Hi All, Im a newbie to C++, I am trying to customize the vector template STL to a template Class. My code is shown below. Im confused about something and maybe somebody here might be able to help me. Lets say X is my vector, which contains 10 elements. I want to assign elements indexed 2 to 5 to another vector Y, so I want to do it like Y = X(2,5). So what I do is i overload the () operators, as marked in (a) below. This creates a new...
0
9484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
Oralloy
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...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
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,...
0
9957
tracyyun
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...
0
8983
agi2029
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 project—planning, coding, testing, and deployment—without 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...
0
5386
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...
1
4055
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
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.