473,698 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to redefine a typedefined type?

For example if anywhere defined MyChar as
typedef char MyChar;

Now I want to redefine MyChar as wchar_t, how can I do this?

Jun 20 '07 #1
10 17948

On Jun 19, 10:25 pm, Amber <guxiaobo1...@g mail.comwrote:
For example if anywhere defined MyChar as
typedef char MyChar;

Now I want to redefine MyChar as wchar_t, how can I do this?

Redefine in what context? If its in a different scope, you can simply:

typedef wchar_t MyChar;

but I'm guessing you can't do that in your case (whatever it may be).
More info?

Chris
Jun 20 '07 #2
On Jun 20, 10:45 am, Chris Fairles <chris.fair...@ gmail.comwrote:
On Jun 19, 10:25 pm, Amber <guxiaobo1...@g mail.comwrote:
For example if anywhere defined MyChar as
typedef char MyChar;
Now I want to redefine MyChar as wchar_t, how can I do this?

Redefine in what context? If its in a different scope, you can simply:

typedef wchar_t MyChar;

but I'm guessing you can't do that in your case (whatever it may be).
More info?

Chris
I include a .h file, which defines some class and use typedef, now I
want replace the typedef with a with my ower type.
Jun 20 '07 #3
On Jun 19, 10:23 pm, Amber <guxiaobo1...@g mail.comwrote:
On Jun 20, 10:45 am, Chris Fairles <chris.fair...@ gmail.comwrote:
On Jun 19, 10:25 pm, Amber <guxiaobo1...@g mail.comwrote:
For example if anywhere defined MyChar as
typedef char MyChar;
Now I want to redefine MyChar as wchar_t, how can I do this?
Redefine in what context? If its in a different scope, you can simply:
typedef wchar_t MyChar;
but I'm guessing you can't do that in your case (whatever it may be).
More info?
Chris

I include a .h file, which defines some class and use typedef, now I
want replace the typedef with a with my ower type.
Unfortunately it's not possible.

Jun 20 '07 #4
On Jun 20, 11:25 am, Amber <guxiaobo1...@g mail.comwrote:
For example if anywhere defined MyChar as
typedef char MyChar;

Now I want to redefine MyChar as wchar_t, how can I do this?
I exactly can't predict on what context you need to behave like this.
typedef is a compile time operator.
In my assumption, you are trying to do a typdefinition according to
some other definitions. Like UNICODE..

In that context you can do as follwos

#ifdef UNICODE // or the symbol you need
typedef char MyChar;
#else
typedef wchar_t MyChar;
#endif

You only need to define or undefine symbol as per your requirement.

Regards,
Sarath
http://sarathc.wordpress.com/

Jun 20 '07 #5
Amber wrote:
For example if anywhere defined MyChar as
typedef char MyChar;

Now I want to redefine MyChar as wchar_t, how can I do this?
You can't redefine a typedef in the same scope.

--
Ian Collins.
Jun 20 '07 #6
I am using loki, in my case somebody defines XXXList as typelist with
some types,
and I am going to appand another type to the list, and then typedef
the new list as XXXList;

Jun 20 '07 #7
Amber wrote:
I am using loki, in my case somebody defines XXXList as typelist with
some types,
and I am going to appand another type to the list, and then typedef
the new list as XXXList;
Were you replying to me? Please retain enough context for your post to
make sense.

One solution would be to put your stuff in its own namespace.

--
Ian Collins.
Jun 20 '07 #8
On Jun 20, 2:55 am, Amber <guxiaobo1...@g mail.comwrote:
I am using loki, in my case somebody defines XXXList as typelist with
some types,
and I am going to appand another type to the list, and then typedef
the new list as XXXList;
You need to call it something else. By the time it reaches your new
typedef, a lot of code and files have already been compiled using the
old typedef. What would be your expected behavior? Would it change
the old code to use the new typelist, or would the old code get the
old value and any future code get the new value?

Jun 20 '07 #9
A crude way is to #define so the given typename actually means
something else (textually) in your code.
Use at your own risk....

Jun 20 '07 #10

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

Similar topics

8
4705
by: Steven Bethard | last post by:
I tried to Google for past discussion on this topic, but without much luck. If this has been discussed before, I'd be grateful for a pointer. Does anyone know why you can't assign a custom mapping type to an object's __dict__? py> class M(object): .... def __getitem__(self, key): .... return 42 .... def __setitem__(self, key, value):
0
1684
by: Michael Bane | last post by:
Am I right in thinking that... 1) in <redefine> I can either extend OR restrict a type but not both? 2) in <redefine> it's not possible to change a type from say <xs:string> to <xs:integer>? 3) if I have schema1.xsd with <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
2
3349
by: BillD | last post by:
I'm trying to derive a schema from a base schema. I want to redefine a "group" from the base schema in my derived schema in order to add more options to the "choice" aggregate (see schema1.xsd sample). schema1.xsd sample: <!-- Here is a clipped down version of the group I want to redefine. --> <xsd:group name="INSURANCESVCRQMSGS"> <xsd:choice> <xsd:element ref="HomePolicyAddRq" minOccurs="1" maxOccurs="1"/>
1
2220
by: Cat | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm getting a validation error when I try to restrict the content of nested groups with xs:redefine whereas the same restriction on xs:element's validates. ============== BASE XMLSCHEMA ================= <?xml version="1.0"?> <xs:schema targetNamespace="test" xmlns="test" xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
3608
by: junlia | last post by:
We are using ACORD xml schema standard, and we need to add to it, so we choose to redefine ACORD xml schema. One of the problems that I ran into is how to add some values to an emumerated list. For an emumerated list like this: <xsd:complexType name="AttachmentType"> <xsd:simpleContent> <xsd:restriction base="OpenEnum"> <xsd:enumeration value="040"/> <xsd:enumeration value="041"/>
2
1465
by: bjhartin | last post by:
Hello all, I am having a problem with extending complex types. I have a simple base schema (FooBar.xsd) which defines XML documents of the following form: <Foo FooAttribute1="aaa"> <Bar BarAttribute1="xxx"/> </Foo>
0
1297
by: bjhartin | last post by:
Hello, I'm struggling to extend the types defined in a schema. I've searched this group (and others) with no luck so far. I have the following two schemas: <!-- foobar.xsd --> <!-- A 'base' schema which will be 'extended' by customer specific ones --> <xs:schema ...>
12
13342
by: Just D | last post by:
All, It was possible before in Pascal, C++, etc. to define our custom data type or redefine the existing type, like in Turbo Pascal we could assume that shortint is int and use all references to shortint like all these variables became int. How can we define our own user data type in C# is we can? Just D.
1
1980
by: Felix T. | last post by:
I have a class called Interval(type.ObjectType) that is supposed to mimic closed mathematical intervals. Right now, it has a lot of methods like this: def __add__(self,other): if type(other) in Numerical: return Interval(self.lower_bound+other, self.upper_bound +other) else: return Interval(self.lower_bound+other.lower_bound,
0
8598
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
9014
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...
0
8855
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
7708
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...
1
6515
isladogs
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...
0
5857
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();...
0
4358
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
3037
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
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.