|
Next: Metrowerks Officially Dead
|
| Author |
Message |
External

Since: Jul 14, 2005 Posts: 55
|
(Msg. 16) Posted: Wed Oct 05, 2005 3:27 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: comp>sys>mac>programmer>codewarrior (more info?)
|
|
|
I wonder...
If I know how to combine them to make it a McString, why do the compiler have a problem with that ?
"Alexander Dymerets" <sashad.TakeThisOut@productengine.com> wrote in message
news:di0gbm$eci$1@toster.te.net.ua...
> Denis @ TheOffice wrote:
> > friend McString operator +(CFStringRef ParmStringRef1, CFStringRef ParmStringRef2);
> >
> > CW tells me it is illegal operator.
> CFStringRef is a pointer to an opaque structure. So you are trying to
> create a + operator for 2 pointers. |
|
| Back to top |
|
 |  |
External

Since: Jun 02, 2005 Posts: 4
|
(Msg. 17) Posted: Wed Oct 05, 2005 4:36 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
| Denis @ TheOffice wrote:
> I wonder...
> If I know how to combine them to make it a McString, why do the compiler have a problem with that ?
If compilers knew all that programmers know, programmers would be needless.
|
|
|
| Back to top |
|
 |  |
External

Since: Jul 14, 2005 Posts: 55
|
(Msg. 18) Posted: Wed Oct 05, 2005 4:36 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Alexander Dymerets" <sashad.RemoveThis@productengine.com> wrote in message
news:di0kea$ouu$1@toster.te.net.ua...
> Denis @ TheOffice wrote:
>
> > I wonder...
> > If I know how to combine them to make it a McString, why do the compiler have a problem with
that ?
> If compilers knew all that programmers know, programmers would be needless.
Well, it's kind of my point don't you think?
If programmers know better, why do the compiler enforce such a rule?
Don't you think it is a flaw? Even if it is a Standard consortium one.
I mean How does that help anybody ? |
|
| Back to top |
|
 |  |
External

Since: Jun 10, 2005 Posts: 11
|
(Msg. 19) Posted: Wed Oct 05, 2005 4:36 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
in article 1128521638.734805.TakeThisOut@www.vif.com, Denis @ TheOffice at
denisco.TakeThisOut@ica.net wrote on 10/5/05 8:17 AM:
> I mean How does that help anybody ?
It kept *you* from overloading operator + on pointers. If you can't see how
that was a good thing, then you need to think about it a bit more. |
|
| Back to top |
|
 |  |
External

Since: Jul 14, 2005 Posts: 55
|
(Msg. 20) Posted: Wed Oct 05, 2005 4:36 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Please, can you help me in this thinking?
I am willing to understand.
Why is it a good thing?
or
Why is it such a bad thing?
Either way I can't figure out right now.
Thanks in advance.
Denis
"Scott Ribe" <scott_ribe.DeleteThis@killerbytes.com> wrote in message
news:BF6957C7.3359C%scott_ribe@killerbytes.com...
> in article 1128521638.734805.DeleteThis@www.vif.com, Denis @ TheOffice at
> denisco.DeleteThis@ica.net wrote on 10/5/05 8:17 AM:
>
> > I mean How does that help anybody ?
>
> It kept *you* from overloading operator + on pointers. If you can't see how
> that was a good thing, then you need to think about it a bit more.
> |
|
| Back to top |
|
 |  |
External

Since: Oct 06, 2005 Posts: 3
|
(Msg. 21) Posted: Thu Oct 06, 2005 7:26 am
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Denis @ TheOffice wrote:
>Please, can you help me in this thinking?
>I am willing to understand.
>
>Why is it a good thing?
>or
>Why is it such a bad thing?
>
>Either way I can't figure out right now.
>
>Thanks in advance.
>Denis
>
>"Scott Ribe" <scott_ribe.DeleteThis@killerbytes.com> wrote in message
>news:BF6957C7.3359C%scott_ribe@killerbytes.com...
>> in article 1128521638.734805.DeleteThis@www.vif.com, Denis @ TheOffice at
>> denisco.DeleteThis@ica.net wrote on 10/5/05 8:17 AM:
>>
>> > I mean How does that help anybody ?
>>
>> It kept *you* from overloading operator + on pointers. If you can't see how
>> that was a good thing, then you need to think about it a bit more.
>>
>
>
Effective C++ : 55 Specific Ways to Improve Your Programs and Designs
(3rd Edition) -- by Scott Meyers
ISBN: 0321334876
Effective STL: 50 Specific Ways to Improve Your Use of the Standard
Template Library -- by Scott Meyers
ISBN: 0201749629
The C++ Programming Language (Special 3rd Edition) -- by Bjarne
Stroustrup
ISBN: 0201700735 |
|
| Back to top |
|
 |  |
External

Since: Jul 14, 2005 Posts: 55
|
(Msg. 22) Posted: Thu Oct 06, 2005 11:16 am
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thanks, I'll have a look...
Although, in the book I have just states it, without given a reasonable reason.
I did find an alternative though, with a macro that upgrade the insignificant CFStringRef to a class
type...
Kind regards,
Denis
"C.R. Osterwald" <rio.RemoveThis@dev.null> wrote in message news:061020050726335157%rio@dev.null...
> Denis @ TheOffice wrote:
>
> >Please, can you help me in this thinking?
> >I am willing to understand.
> >
> >Why is it a good thing?
> >or
> >Why is it such a bad thing?
> >
> >Either way I can't figure out right now.
> >
> >Thanks in advance.
> >Denis
> >
> >"Scott Ribe" <scott_ribe.RemoveThis@killerbytes.com> wrote in message
> >news:BF6957C7.3359C%scott_ribe@killerbytes.com...
> >> in article 1128521638.734805.RemoveThis@www.vif.com, Denis @ TheOffice at
> >> denisco.RemoveThis@ica.net wrote on 10/5/05 8:17 AM:
> >>
> >> > I mean How does that help anybody ?
> >>
> >> It kept *you* from overloading operator + on pointers. If you can't see how
> >> that was a good thing, then you need to think about it a bit more.
> >>
> >
> >
>
> Effective C++ : 55 Specific Ways to Improve Your Programs and Designs
> (3rd Edition) -- by Scott Meyers
> ISBN: 0321334876
>
> Effective STL: 50 Specific Ways to Improve Your Use of the Standard
> Template Library -- by Scott Meyers
> ISBN: 0201749629
>
> The C++ Programming Language (Special 3rd Edition) -- by Bjarne
> Stroustrup
> ISBN: 0201700735 |
|
| Back to top |
|
 |  |
External

Since: Oct 06, 2005 Posts: 3
|
(Msg. 23) Posted: Thu Oct 06, 2005 5:33 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Denis @ TheOffice wrote:
>Thanks, I'll have a look...
>
>Although, in the book I have just states it, without given a reasonable reason.
>
>I did find an alternative though, with a macro that upgrade the insignificant
>CFStringRef to a class
>type...
>
>Kind regards,
>Denis
These books are absolutely indispensable for anyone writing C++.
>
>
>"C.R. Osterwald" <rio.RemoveThis@dev.null> wrote in message
>news:061020050726335157%rio@dev.null...
>> Denis @ TheOffice wrote:
>>
>> >Please, can you help me in this thinking?
>> >I am willing to understand.
>> >
>> >Why is it a good thing?
>> >or
>> >Why is it such a bad thing?
>> >
>> >Either way I can't figure out right now.
>> >
>> >Thanks in advance.
>> >Denis
>> >
>> >"Scott Ribe" <scott_ribe.RemoveThis@killerbytes.com> wrote in message
>> >news:BF6957C7.3359C%scott_ribe@killerbytes.com...
>> >> in article 1128521638.734805.RemoveThis@www.vif.com, Denis @ TheOffice at
>> >> denisco.RemoveThis@ica.net wrote on 10/5/05 8:17 AM:
>> >>
>> >> > I mean How does that help anybody ?
>> >>
>> >> It kept *you* from overloading operator + on pointers. If you can't see
>> >> how
>> >> that was a good thing, then you need to think about it a bit more.
>> >>
>> >
>> >
>>
>> Effective C++ : 55 Specific Ways to Improve Your Programs and Designs
>> (3rd Edition) -- by Scott Meyers
>> ISBN: 0321334876
>>
>> Effective STL: 50 Specific Ways to Improve Your Use of the Standard
>> Template Library -- by Scott Meyers
>> ISBN: 0201749629
>>
>> The C++ Programming Language (Special 3rd Edition) -- by Bjarne
>> Stroustrup
>> ISBN: 0201700735
>
> |
|
| Back to top |
|
 |  |
External

Since: Jul 06, 2005 Posts: 41
|
(Msg. 24) Posted: Thu Oct 06, 2005 7:59 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> I did find an alternative though, with a macro that upgrade the
> insignificant CFStringRef
Insignificant?
> to a class type...
Ugh. Sounds like a hack, and one you're using to fix a problem you
don't understand. That's not good programming in any book.
A much better solution IMO would be to use your McString class
throughout and define a + operator for that.
Larry |
|
| Back to top |
|
 |  |
External

Since: Jul 06, 2005 Posts: 41
|
(Msg. 25) Posted: Thu Oct 06, 2005 8:03 pm
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> Does that mean that UniChar in CFDictionairies and
> CFPreferences... won't work.
> Is that what you mean?
No, not at all. I don't even know why you'd ask that, in part because
your question doesn't actually make sense. CFDictionairies don't store
UniChars.
Larry |
|
| Back to top |
|
 |  |
External

Since: Jul 14, 2005 Posts: 55
|
(Msg. 26) Posted: Fri Oct 07, 2005 10:33 am
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
<larry.TakeThisOut@skytag.com> wrote in message news:1128653963.319097.85340@g44g2000cwa.googlegroups.com...
> > I did find an alternative though, with a macro that upgrade the
> > insignificant CFStringRef
>
> Insignificant?
I meant meaningless.
> > to a class type...
>
> Ugh. Sounds like a hack, and one you're using to fix a problem you
> don't understand. That's not good programming in any book.
>
IMHO, it is as good programming as CFSTR(...)
> A much better solution IMO would be to use your McString class
> throughout and define a + operator for that.
I whish I could understand what you've just said.
Perhaps if you could put some code that illustrates it.
Regards,
Denis |
|
| Back to top |
|
 |  |
External

Since: Jun 15, 2005 Posts: 16
|
(Msg. 27) Posted: Fri Oct 14, 2005 12:49 am
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1129261706.215356.TakeThisOut@www.vif.com>, < @> wrote:
> That, I have done (since day 1), but we still cannot use the form:
>
> {
> ...
> TString MyString;
>
> MyString = CFSTR("str1") + CFSTR("str2");
> }
Isn't this just as well:
TString MyString(CFSTR("str1"), CFSTR("str2"));
or if you're opposed to extra convenience ctors:
TString MyString(CFSTR("str1"));
MyString += CFSTR("str2");
>
> OR
>
> If you have a CFStringRef comming from somewhere
> void InAFunction(CFStringRef CFStrFromSomewhere)
Change the signature of InAFunction to accept a TString instead of
CFStringRef. You can still pass it a CFStringRef as long as TString
provides a CFStringRef ctor.
The larger idea is you write a single foundational/framework wrapper
for each OS construct/api-set. Your client /application code (e.g.
InAFunction above) then has no knowledge of these lower level beasts or
how they are implemented.
And you shouldn't be worrying so much about supporting CFSTR - when do
you concatonate 2 const, ascii-only strings in your app? Looking at
some of my code I'm only seeing CFSTR used for:
xml keys
nibs/resources names in my bundle
CFCopyLocalizedStringFromTable calls |
|
| Back to top |
|
 |  |
External

Since: Jul 06, 2005 Posts: 41
|
(Msg. 28) Posted: Sat Oct 15, 2005 10:07 am
Post subject: Re: How do you define a UniChar constant? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Chris Baum wrote:
> In article <1129261706.215356 DeleteThis @www.vif.com>, < @> wrote:
>
> > That, I have done (since day 1), but we still cannot use the form:
> >
> > {
> > ...
> > TString MyString;
> >
> > MyString = CFSTR("str1") + CFSTR("str2");
> > }
>
> Isn't this just as well:
>
> TString MyString(CFSTR("str1"), CFSTR("str2"));
>
> or if you're opposed to extra convenience ctors:
>
> TString MyString(CFSTR("str1"));
> MyString += CFSTR("str2");
This is what I do, except I'd have:
TString myString("str1");
myString += "str2";
since my CFString class has constructors and operators to work with
C-strings.
>
> >
> > OR
> >
> > If you have a CFStringRef comming from somewhere
> > void InAFunction(CFStringRef CFStrFromSomewhere)
>
> Change the signature of InAFunction to accept a TString instead of
> CFStringRef. You can still pass it a CFStringRef as long as TString
> provides a CFStringRef ctor.
This I don't do unless I need functions or operators in TString.
Otherwise I write functions to accept a CFStringRef. That way I can
pass TStrings, CFStrings, and CFMutableStrings, all without invoking
contructors and destructors.
>
> The larger idea is you write a single foundational/framework wrapper
> for each OS construct/api-set. Your client /application code (e.g.
> InAFunction above) then has no knowledge of these lower level beasts or
> how they are implemented.
>
> And you shouldn't be worrying so much about supporting CFSTR - when do
> you concatonate 2 const, ascii-only strings in your app?
Hard-code strings, never. I do build some CFPreferences keys by
concantenating a hard-coded ASCII string and an ASCII string created at
runtime.
> Looking at
> some of my code I'm only seeing CFSTR used for:
>
> xml keys
> nibs/resources names in my bundle
I don't even use them for this. All of my code that does this kind of
stuff is tucked away in utility functions that take C-strings and
create TStrings from them because I didn't want to be hassled with
typing CFSTR("x") all the time when I could just use "x" instead.
> CFCopyLocalizedStringFromTable calls
Or for this. Same reason.
I do have some CFSTRs in my application, but I avoid them if I can
because I hate the extra typing.
Larry |
|
| Back to top |
|
 |  |
| Related Topics: | Bug in alloc.c? - I'm getting an infinite loop in alloc.c, which is located in MSL/MSL_C/MSL_Common/Src. This is with CW 9.5. The function is allocate_from_var_pools. There is a do/while loop that searches for a block with the required size to allocate a block of..
Multiply defined symbol: .bss - Hi, when trying to build a dll for Windows using CW9 on MacOS, I get an error message like: Link Error : Multiply defined symbol: .bss in files file1.cpp, file2.cpp The same message with the same filenames is repeated several times, but....
Where next? - Hi folks, All of my recent Mac coding has been Carbon C++, mostly using PowerPlant as a framework. As most of my clients are moving to X and CW's future is, shall we say, uncertain I'm wondering where to look for my future coding setup. I've dabbled....
Does mwcc work on Tiger? - Anybody using the comand line compilers on 10.4? When saving the following simple program as /tmp/x.cpp: int main() { double x = 0.5; return 0; } and trying to compile it with $ mwcc -c /tmp/x.cpp , I get the error message Error :....
Console app "file" selector - Hello, I feel like I've asked this before, but I did a search on the archives and came up short. I've got a console std c app that I'm compiling with CW. When it runs, it pops up a little menu where I can type in some command line arguments (for.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|