Monday, February 1, 2010

comp.lang.c++ - 7 new messages in 6 topics - digest

comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en

comp.lang.c++@googlegroups.com

Today's topics:

* Escape a string to bytes - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/0ed981f009a7ba73?hl=en
* Another strange linux kernel change - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/e05a4158a9750a03?hl=en
* Safe to use substr? - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/cece8bdad80abdbe?hl=en
* isspace - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/89ca303518428e34?hl=en
* ISO C++ forbids assignment of arrays - is there a way out ? - 1 messages, 1
author
http://groups.google.com/group/comp.lang.c++/t/3653ac60c7f02d4a?hl=en
* 。◕‿◕。 2010 Cheap price wholesale Affliction Jean, Bape Jean, G-star Jean,
Evisu Jean at www.fjrjtrade.com <Paypal Payment> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/d2817deb6e12ca1b?hl=en

==============================================================================
TOPIC: Escape a string to bytes
http://groups.google.com/group/comp.lang.c++/t/0ed981f009a7ba73?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 7:23 pm
From: ram@zedat.fu-berlin.de (Stefan Ram)


Philliam Auriemma <phil.auriemma@gmail.com> writes:
>Any idea how I could make it into a 'string' that could contain null
>characters?

This is already possible with the version you just quoted.


==============================================================================
TOPIC: Another strange linux kernel change
http://groups.google.com/group/comp.lang.c++/t/e05a4158a9750a03?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 8:00 pm
From: tonydee


On Jan 31, 9:04 pm, "Man-wai Chang to The Door (24000bps)"
<toylet.toy...@gmail.com> wrote:
> If that line was critical, it should have caused a kernel error in the
> very beginning... :)

Ummmm... if your idea of quality control is that anything that doesn't
immediately crash your kernel can't be too bad, then please don't
submit any code.... ;-P. - Tony

==============================================================================
TOPIC: Safe to use substr?
http://groups.google.com/group/comp.lang.c++/t/cece8bdad80abdbe?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 31 2010 8:22 pm
From: LR


James Kanze wrote:
> On 31 Jan, 16:58, Immortal Nephi <Immortal_Ne...@hotmail.com> wrote:
>
>> The minimum size_type is 0 and maximum size_type is 0xFFFFFFFE
>> (on 32 bit machine). Both integer values provide you the
>> information how many elements do string have.
>
> What do you mean by "both" here? A zero value designates the
> first character of the string, or indicates that the length of
> the string is 0. The maximum value is used as a sentinal:
> std::string::size will never return it. The only functions
> which do return it are those which look for something, and they
> use it as a special value, to indicate that they didn't find
> what they were looking for.
>
>> The 0xFFFFFFFF or -1 indicates that data in the string is not
>> found or is not valid.
>
> (Just a nit, but 0xFFFFFFFF is *not* -1. They're two different
> values.)
>
>> Let's discuss substr() function. The substr() function's
>> first parameter must always have minimum size_type and maximum
>> size_type.
>
> The first argument must be in the range [0...s.size()], where s
> is the string you're concerned with. It specifies the index of
> the first character in the substring you want.
>
>> If 0xFFFFFFFF or -1 is detected, then exception will be
>> thrown.
>
> (Again, -1 cannot be detected, because it cannot be represented
> on the type of the argument.)

My copy of the standard, or my most recent copy of a working draft
explicitly initializes static const size_type npos = -1;

LR


== 2 of 2 ==
Date: Sun, Jan 31 2010 8:28 pm
From: LR


James Kanze wrote:
> On 31 Jan, 21:19, LR <lr...@superlink.net> wrote:
>> Immortal Nephi wrote:
>
> [...]
>> I think this will work:
>
>> const std::string
>> data = std::string("Hello ") + '\0' + std::string("World");
>
> An even simpler solution might be:
> std::string const data( "Hello \0World", 12 );

I didn't think of that, but I hate to count things since I think it
makes maintenance more difficult.

LR

==============================================================================
TOPIC: isspace
http://groups.google.com/group/comp.lang.c++/t/89ca303518428e34?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 11:15 pm
From: Paavo Helde


gervaz <gervaz@gmail.com> wrote in
news:05ee428d-a702-4e92-ad57-14a554a72abf@3g2000yqn.googlegroups.com:

> On Jan 31, 2:17 pm, Paavo Helde <myfirstn...@osa.pri.ee> wrote:
>> gervaz <ger...@gmail.com> wrote
>> innews:a5a4ece2-5b9d-4846-a818-9de61c1306
> 54@r24g2000yqd.googlegroups.com:
>>
>>
>>
>> > On Jan 31, 10:39 am, Paavo Helde <myfirstn...@osa.pri.ee> wrote:
>> >> Paavo Helde <myfirstn...@osa.pri.ee> wrote
>> >> innews:Xns9D116950C4paavo256@2
>> > 16.196.109.131:
>>
>> >> > gervaz <ger...@gmail.com> wrote in news:f9eec1c9-5570-461a-bdec-
>> >> > 6dec26dab...@o28g2000yqh.googlegroups.com:
>>
>> >> >> On Jan 30, 1:15 pm, James Kanze <james.ka...@gmail.com> wrote:
>> >> >>> On Jan 30, 12:05 pm, r...@zedat.fu-berlin.de (Stefan Ram)
>> >> >>> wrote:
>>
>> >> >>> > James Kanze <james.ka...@gmail.com> writes:
>> >> >>> > >There are no standard names for locales
>> >> >>> >   AFAIK, C90 defines a locale by the name of "C",
>> >> >>> >   which should also be visible from C++.
>>
>> >> >>> And Posix defines "POSIX".  Neither of which are really usefu
> l
>> >> >>> for anything.
>>
>> >> >>> --
>> >> >>> James Kanze
>>
>> >> >> Ok, so I think that I will open my file specifying to use UTF-8
>> >> >> encoding, but how can I do it in C++?
>>
>> >> > You can open it as a narrow stream and read in as binary UTF-8,
>> >> > or (maybe) you can open it as a wide stream and get an automatic
>> >> > translation from UTF-8 to wchar_t. The following example assumes
>> >> > that you have a file test1.utf containing valid UTF-8 text. It
>> >> > reads the file in as a wide stream and prints out the numeric
>> >> > values of all wchar_t characters.
>>
>> >> > #include <iostream>
>> >> > #include <fstream>
>> >> > #include <locale>
>> >> > #include <string>
>>
>> >> > int main() {
>> >> >     std::wifstream is;
>> >> >     const std::locale filelocale("en_US.UTF8");
>> >> >     is.imbue(filelocale);
>> >> >     is.open("test1.utf8");
>>
>> >> >     std::wstring s;
>> >> >     while(std::getline(is, s)) {
>> >> >         for (std::wstring::size_type j=0; j<s.
> length(); ++j)
>> > {
>> >> >             std::cout << s[j] << " ";
>> >> >         }
>> >> >         std::cout << "\n";
>> >> >     }
>> >> > }
>>
>> >> > (Tested on Linux with a recent gcc, I am not too sure if this
>> >> > works on Windows. First, wchar_t in MSVC is too narrow for real
>> >> > Unicode, at best one might get UTF-16 as a result.)
>>
>> >> For curiosity, I tested this also on Windows with MSVC9, and as
>> >> expected it did not work, the locale construction immediately
>> >> threw an exception (bad locale name). Neither did any alterations
>> >> work ("english.UTF8", ".UTF8", ".utf-8", ".65001").
>>
>> >> Thus, if one wants any portability it seems the best approach
>> >> currently is still to read in binary UTF-8 and perform any needed
>> >> conversions by hand.
>>
>> >> Paavo
>>
>> > Under Windows, you have to use const std::locale filelocale
>> > ("English_Australia.1252") according to
>> >http://docs.moodle.org/en/Table_of_locales, I've tested it in VC++08
>> > and it works. Any suggestion in how to handle the dualism?
>>
>> Did you actually test the results? It seems this is reading UTF-8 in
>> unaltered, so there is no point to use a wide stream in the first
>> place.
>>
>> Paavo
>
> Well, yeah, although using an example file like
> http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt and using
> plain std::string, std::ifstream and std::cout everything works fine,
> if I put the 'w' in front of all this types the sysout fails
> producing:
>
> UTF-8 encoded sample plain-text file
> Γ
>
> Why??

Because codepage 1252 has nothing to do with UTF-8.

BTW, in Windows, I would not rely also too much on what you see on the
console. That's why I printed out only numeric wchar_t values in the
earlier example.


Paavo

==============================================================================
TOPIC: ISO C++ forbids assignment of arrays - is there a way out ?
http://groups.google.com/group/comp.lang.c++/t/3653ac60c7f02d4a?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 11:54 pm
From: Xavier Roche


Hi folks,

How to assign an array in a constructor, when the array is needed in
another constructor ?

Typical case: a class "A" defined elsewhere (ie. not my code) which
takes an int&/char** as constructor:

class A {
public:
A(int & argc, char ** argv);
}

And my class B, which has A as member. A must be initialized in the
constructor ; therefore I tried the following construct:

class B {
public:
B();

protected:
A a;

private:
char progName[4]; // dummy
int argc;
char *argv[2];
}

B::B(): progName("foo"),
argc(1),
argv({progName, NULL}),
a(argc, argv)
{
}

This code is not correct (and won't compile) - as I can not initialize
the array directly. ("expected primary-expression before '{' token" --
"ISO C++ forbids assignment of arrays")

Is there a way out, or do I have to give up and use a pointer to A as
member, with proper "manual" new construct ?

Thanks in advance for any enlightenment.

==============================================================================
TOPIC: 。◕‿◕。 2010 Cheap price wholesale Affliction Jean, Bape Jean, G-star
Jean, Evisu Jean at www.fjrjtrade.com <Paypal Payment>
http://groups.google.com/group/comp.lang.c++/t/d2817deb6e12ca1b?hl=en
==============================================================================

== 1 of 1 ==
Date: Mon, Feb 1 2010 12:10 am
From: "www.fjrjtrade.com"


。◕‿◕。 2010 Cheap price wholesale Affliction Jean, Bape Jean, G-star
Jean, Evisu Jean at www.fjrjtrade.com <Paypal Payment>


Cheap Wholesale Jeans www.fjrjtrade.com

Cheap Wholesale Jeans www.fjrjtrade.com

Cheap Wholesale Jeans www.fjrjtrade.com

╃Men Size 30,32,34,36,38,40 Women Size 26,27,28,29,30,31 Cheap
Wholesale Jean

Cheap wholesale ZEN Jean, Laguna Beach Jean, Artful Dodger Jean, BBC
Jean, Cavalli Jean, Prada Jean, RMC Jean, Roca Wear Jean, Affliction
Jean, Akademiks Jean, Armani Jean, Bape Jean, Black Label Jean,
Christian Audigier Jean, Coogi Jean, Crown Holder Jean, D&G Jean,
Diesel Jean, Ecko Unltd Jean, Ed Hardy Jean, Evisu Jean, G-Star Jean,
Gucci Jean, Iceberg Jean, Jack&Jones Jean, Justcavalli Jean, Kanji
Jean, LEVI'S Jean, LRG Jean, LV Jean, Rock Jean, True Relig Jean,
Versace Jean ect

http://www.fjrjtrade.com/1261-Jean.html

Cheap wholesale Affliction Jean (paypal payment)

http://www.fjrjtrade.com/1262-Affliction-Jean.html

Cheap wholesale Bape Jean (paypal payment)

http://www.fjrjtrade.com/1265-Bape-Jean.html

Cheap wholesale G-Star Jean (paypal payment)

http://www.fjrjtrade.com/1275-G-Star-Jean.html

Cheap wholesale Evisu Jean (paypal payment)

http://www.fjrjtrade.com/1274-Evisu-Jean.html

Wholesale more others Jeans at Website:
http://www.fjrjtrade.com


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en

To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

No comments: