« first day (362 days earlier)      last day (4580 days later) » 

4:00 PM
UTF-16 (16-bit Unicode Transformation Format) is a character encoding for Unicode capable of encoding 1,112,064 numbers (called code points) in the Unicode code space from 0 to 0x10FFFF. It produces a variable-length result of either one or two 16-bit code units per code point. The older UCS-2 (2-byte Universal Character Set) is a similar character encoding that was superseded by UTF-16 in version 2.0 of the Unicode standard in July 1996. It produces a fixed-length format by simply using the code point as the 16-bit code unit and produces exactly the same result as UTF-16 for 96.9% of all...
 
* 0x10000 is subtracted from the code point, leaving a 20 bit number in the range 0..0xFFFFF.
* The top ten bits (a number in the range 0..0x3FF) are added to 0xD800 to give the first code unit or high surrogate, which will be in the range 0xD800..0xDBFF.
* The low ten bits (also in the range 0..0x3FF) are added to 0xDC00 to give the second code unit or low surrogate, which will be in the range 0xDC00..0xDFFF.
 
> Code points from the other planes (called Supplementary Planes) are encoded in UTF-16 by pairs of 16-bit code units called a surrogate pair, by the following scheme:
Good luck.
 
I don't think there are, the first value in surrogate pair is surely not in the ASCII range
 
@StackedCrooked Heh, I guess '\n' can easily appear in a surrogate pair.
@Praetorian Right, but the difficult part is finding in what way it's not in the BMP.
 
so, assuming that I only ever use values in the ASCII range for, e.g. special characters
 
4:01 PM
@DeadMG you can borrow this code. It's open source under the boost license.
 
then I will never have to worry about surrogates- the other surrogates I can just throw in together and not have to decode them
 
If crazy stuff only appears in identifiers and such you can just keep them as they come.
I assume you're not needing surrogates for your keywords and such.
 
no, nothing like that
 
Assuming you're requiring the encoding of all source files to be UTF-16.
 
Also, I'm surprised nobody mentioned that but UTF-16 is so passé, UTF-8 is where all the cool languages hang out at.
 
4:04 PM
UTF-16 is directly compatible with Windows, Java, and C#
 
@LucDanton I think it was something to do with Windows and wchar_t all over.
 
so I'd honestly have to pick it for the maximum compatibility
 
Right, passé.
 
wchar_t is a bit of a failure.
 
4:04 PM
Visual Studio also supports "MultiByte encoding". I never understood what that means actually.
 
yes, it is
 
Putting the 'backwards' in backward compatibility!
 
@StackedCrooked UTF-8, I believe
 
It means char instead of wchar_t.
 
one of the settings is 8-bit, and the other is the old UCS-2
 
4:05 PM
In all those TCHAR stuff.
 
ugh
that was a dumb idea
 
AFAIR.
 
I mean, why would anyone want to switch back to ASCII?
 
I see your ASCII and raise you thousands of codepages.
 
@DeadMG does Visual Studio have <cuchar>?
@CatPlusPlus Fold.
 
4:07 PM
no
I definitely fold
 
Maybe you could use mbrtoc32 and such.
 
@DeadMG I tried to use it with UTF-8 but it didn't work.
 
now I just have to remember wtf I'm doing with BOMs
 
Switching to the right endianness.
 
Use them to detect endianness.
That's what they're for.
 
4:07 PM
UTF-16 can be either LE or BE.
 
Jul 21 at 12:08, by Martinho Fernandes
FF FE UTF-16, little endian
FE FF UTF-16, big endian
 
Another reason why you have to decode it first.
 
does UTF-32 still have that?
 
Or on the go, whatever.
It always had that.
 
It didn't change since last July.
 
4:09 PM
Say, how worse can ICU be rather than all that Windows stuff?
Just trollin sayin'.
 
hmmm
I get a really, really bad feeling about every API which is half C-with-Classes
 
Only UTF-8 (well, UTF-7 probably too) is the only UTF encoding that has defined endianness and doesn't require BOM.
 
@DeadMG Still waiting on Boost.Unicode :(
 
yeah
ok
so
 
@CatPlusPlus But it does allow it :(
 
4:11 PM
check first two bytes for either 0xFFFE or 0xFEFF
 
 anyone?
 
if not found, reject file as not UTF-16
 
Yeah.
 
if 0xFEFF, then swap all byte pairs as x86 is LE
 
4:12 PM
then I can just for_each over the result, and any characters in the ASCII plane, I'll be fine to find without having to decode
 
The idea was that it could be used to detect UTF-8.
But of course everyone borked it.
 
@DeadMG ASCII character codepoints can appear as low surrogates, I think.
 
so actually, I won't have to be particularly Unicode-aware
 
So you need to be careful.
 
oh
didn't you just post and say that they can't be in either side of a surrogate?
 
4:13 PM
Wait, they can't.
 
* The top ten bits (a number in the range 0..0x3FF) are added to 0xD800 to give the first code unit or high surrogate, which will be in the range 0xD800..0xDBFF.
* The low ten bits (also in the range 0..0x3FF) are added to 0xDC00 to give the second code unit or low surrogate, which will be in the range 0xDC00..0xDFFF.
 
Something borked in my brain.
 
ok
so if I only care about finding ASCII characters, then I can just for_each over every double-byte pair
 
I guess. Is there any Unicode whitespace that requires surrogates?
(Though you can just ignore it.)
 
do I have to support Unicode whitespace?
 
4:15 PM
It's your choice.
I have no idea if they're used anywhere.
 
This certainly was an instructive Unicode session.
@RMartinhoFernandes I'd like non-breakable space to be rendered as such, typography is srs bsns!
 
Code is not typography.
 
oh, I don't need to know or care about rendering
someone else's job to deal with that
I just need to lex & parse
 
@RMartinhoFernandes Eh, are you saying there's a mechanism to embed typography rules in e.g. a web page?
 
ok
 
4:18 PM
Context man, this is not a markup language we're talking about.
 
do I have to support any encodings that aren't ASCII, UTF-8, UTF-16, or UTF-32?
 
@RMartinhoFernandes So how do you get a webpage to render "The use of the colon in French typography is straightforward : whitespace on either side" 'appropriately'?
 
Allo
 
So long, Dennis, and thanks for the curly braces!
 
nah, let's not support any other encodings
 
4:19 PM
Plus using a nbs is already an approximation, I think the correct typography is a thin-space or whatever.
 
@LucDanton Dunno enough HTML to answer that.
 
ok
 
@RMartinhoFernandes Well you put a nbs before the colon, that's how.
 
Plus, that French typography looks ugly.
 
so for UTF-32, the same trick will work w.r.t. checking for ASCII characters
right?
 
4:20 PM
@RMartinhoFernandes The colon isn't used much. When it is, the whitespace is appreciable.
 
just thinking about how I'm going to have to support the different encodings at run-time
 
Hmm, what if one of those is combined? ?
 
@DeadMG No it's easier. Go over each code unit, check if it is '\n'.
(I'm assuming that '\n' doesn't combine though.)
 
@LucDanton Ok, but the point was, do you really need to allow the use of weird whitespace to say, separate identifiers?
 
@RMartinhoFernandes Well you asked if they were used anywhere. :(
 
4:22 PM
Ok.
 
so actually
 
d´o would not parse as a keyword.
 
decoding UTF-16 into 32bit codepoints isn't really that hard
 
do´ would also fail to parse as a keyword because of the extraneous ´. I guess combining characters are not an issue then.
 
4:25 PM
what is a bit distribution table? seems odd
 
A table that says where each bit goes to? Just guessing.
 
lol
 
Page 93 in the standard.
 
What standard?
 
the Unicode Standard
one would assume
 
4:27 PM
Right.
So, WideC is going to support POO, PILE OF in identifiers. Awesome.
 
I never noticed you could buy software in the Ubuntu software center. Is that new?
 
You can?
What kind of software do they sell?
 
yes
actually, I'm not sure that it will
identifiers must be composed of letters
 
@RMartinhoFernandes Just booted a live usb of the new release. I see Braid at the top of the popularity list.
 
4:29 PM
_ is not a letter.
 
now, I'm not currently sure how to ask if a Unicode codepoint(s) contain letters
oh, and underscores
 
Each codepoint has categories attached to it.
 
Mostly appears to be games.
 
but i don't think that POO, PILE OF is a letter
@CatPlusPlus Is there a speedy/easy way to determine what those categories are?
 
@DeadMG So π is acceptable?
 
4:30 PM
I seem to recall that ASCII was designed so that all the letters had a specific bit set, for example
 
Wait, magazine issues? It's not just software it appears.
 
You get Unicode Character Database, and parse it into a any format you like.
 
16
A: remove ith item from c++ std::vector

FredOverflowHere is an O(1) solution, assuming you don't care about the order of elements: #include <algorithm> // ... { using std::swap; swap(pList[i], pList.back()); pList.pop_back(); } For PODs, assignment is faster than swapping, so you should simply write: pList[i] = pList.back()...

peer review for my C++11 update, please
 
@FredOverflow Valid.
 
Seems ok. Have the upvote you were fishing for under the disguise of a peer review.
 
4:32 PM
Looks fine.
 
great thanks
 
@RMartinhoFernandes lol
 
does Unicode still have locales?
I would guess not
 
Locales are not just about text.
 
4:33 PM
but don't want to find out the hard way
yeah, but I don't need any other functionality
 
A locale dictates for example, how numbers are displayed.
 
right now, anyway
 
@DeadMG If you store identifiers in an ordered structure then a non-locale aware sorting is fine.
 
hmmm
I only plan on ordering via hash
that seems to be more logical and easier than lexicographical comparison
 
You mean, using a hash table?
 
4:35 PM
Same for equality.
 
and better performance!
 
Yay, I wrote an answer and managed to get right and left wrong.
Twice.
 
lol
 
I really need to remember to never do driving license.
 
don't ever not forget to not do your driving licence
no, wait
 
4:38 PM
Yay it's easier to enable a triple monitor desktop. (Still testing Oneiric.)
 
easier than what?
 
Than enabling quadruple monitor desktop.
 
It's certainly cheaper.
 
Als
ola
 
And also weighs less.
 
4:39 PM
Hi.
@Als That's almost the standard Portguese greeting (just lacks an accent).
 
What's the opposite of "heavy"?
 
is that right?
 
Light.
 
light
 
4:40 PM
Dark.
 
Medic.
 
Als
@RMartinhoFernandes: Yup :) I know a few words in a few languages
 
Medivac
 
In German, "light" and "easy" are the same word ("leicht").
 
4:40 PM
In English "hard" (opposite of "soft") and "hard" (opposite of "easy") are the same word.
 
I know a few languages in a few words.
 
Oops, that didn't come out as expected.
 
That doesn't make any sense, does it.
 
Als
Hard and Harder are different :P
not hard and hard
 
In English "fuck" is the only word you'll ever need.
 
4:41 PM
@FredOverflow Light is Licht and leicht (one of them)!
 
lol
 
@LucDanton "light" is also Chinese for "right"
 
Als
@CatPlusPlus; Fuck is the only word for....?
 
@Als Everything, really
 
Everything.
 
Als
4:42 PM
@FredOverflow: You know Chinese?
 
Fuck can be substituted into virtually anything and be grammatically correct
 
@Als You know humor?
 
@Als No, he's making a stereotypical joke.
 
@DeadMG fuck::fuck<fuck> fuck;
 
Als
@FredOverflow: I dunno chinese How am i supposed to know
 
4:42 PM
@Als He's a ronery guy, learns Chinese to pass time
 
"Fuck you", "Is it fuck", "Fucker", "Fucking fuck-face", "Fucked"
 
Als
oh la la "fuck"
 
in fact
 
@DeadMG But "fucking" needs something after it. Like "fucking fuck".
 
4:43 PM
it's even semi-correct to basically just insert it randomly, e.g. "Fucktastic"
 
Obligatory.
 
Als
@RMartinhoFernandes: Actually fucking needs someone to do it with :P
 
@Als or a pie
 
Als
haha
American Pie :P
 
4:44 PM
Or a π.
 
Als
what the fuck is n?
 
probably pi
 
Try again.
 
Als
it doesn't look like a pi!
 
4:45 PM
It doesn't smell like a pi!
It doesn't taste like a pi!
 
Als
it smelt like a fart
 
It's not a duck.
 
No, it's SUPERMAN!
 
no, it's a fuck
 
Derp.
 
4:46 PM
I'm a vegetarian, can I have soy typing instead, please? :)
 
Als
Define Superman? The man who wears his undies over his pants.
 
The man of the base class in Java?
 
@FredOverflow What?
 
super.man();
 
Ducks are evil.
 
4:47 PM
@RMartinhoFernandes You know, duck typing, ducks are animals, soy is not, soy typing.
 
Als
Cats too!
 
Als
@FredOverflow: Ducks are birds
 
@Als And birds are animals, right?
 
"I'll stick to what I know."
The cow goes 'Mooo'!
 
Als
4:47 PM
@FredOverflow: Techincally No
 
The Barbara goes Moo!
 
That.
 
Birds are not plants.
Nor fungi.
 
Bird is the word.
 
Als
4:48 PM
Birds are not tigers
its irrelevant what they are not.
 
@RMartinhoFernandes Or protozoa.
 
man, I feel kind of sick
 
> Birds (class Aves) are feathered, winged, bipedal, endothermic (warm-blooded), egg-laying, vertebrate animals.
 
but then, really, what's new?
 
Birds (class Aves) are feathered, winged, bipedal, endothermic (warm-blooded), egg-laying, vertebrate animals. Around 10,000 living species makes them the most speciose class of tetrapod vertebrates. They inhabit ecosystems across the globe, from the Arctic to the Antarctic. Extant birds range in size from the Bee Hummingbird to the Ostrich. The fossil record indicates birds evolved from theropod dinosaurs during the Jurassic period, around 160 million years (Ma) ago. Paleontologists regard birds as the only clade of dinosaurs to have survived the Cretaceous–Paleogene extinction even...
 
4:48 PM
Nor whatever they call all that unicellular crap nowadays.
 
Birds are adjectives.
Lots of them.
 
@RMartinhoFernandes I think I got it wrong, it might be 'eukaryote'.
 
Oh, cap.
I was wondering why nobody upvotes my brillant answers.
 
@LucDanton That's why I settled with that evasive sentence.
They changed it all over during my lifetime.
That's not fair.
 
Als
They changed what?
 
4:50 PM
@FredOverflow Careful. Andy might get upset if he thinks you're calling his wife a cow!
 
Stuff.
 
@Als What they call all that unicellular crap.
 
@JerryCoffin They're still together? That's so cute!
 
Oh, there totally was pay-for stuff in the Ubuntu software center before. I'm not sure how I missed that.
 
Als
@RMartinhoFernandes: Uhm ok...touchy topic
:P
 
4:51 PM
"We've got an app store for that"
 
@RMartinhoFernandes Conway's game of life?
 
@CatPlusPlus I think you mean 'application store'.
 
So that's what this "life" is all about!
 
A breeder!
 
Looks like a bomber strike.
 
Als
4:53 PM
whoa AIDS virus!
 
@CatPlusPlus Good point. Why isn't there an RTS in the style of the game of life?
 
@CatPlusPlus And each bomb dropped is a glider gun!
 
because GoL takes a hideous amount of time and effort to construct anything interesting
 
@DeadMG I only meant a stylistic inspiration.
 
4:56 PM
BUT IT'S UGLY IT'S 2011 WHY ARE YOU MAKING UGLY GAMES BOOOH.
 
@FredOverflow Honestly, I have no idea.
 
I hate people sometimes. No, wait, I hate people most of the time.
 
I thought nowadays RTS stood for "five hour tech demo".
 
@JerryCoffin I know pronounce you King and Cow!
 
But I might be biased.
 
4:56 PM
I hate people in the morning.
 
Als
@CatPlusPlus: People love cats though
 
And I'm confusing it with FPS.
 
TBH, I don't recall any AAA RTS lately.
 
Or something else.
 
Als
Frames Per Second?
:O
 
4:57 PM
I'm not that knowledgeable about games.
 
Starcraft 2
 
Oh, right, that.
 
@Als First Person Shooter.
 
Als
@RMartinhoFernandes: I am a dud in games :(
 
Well, I'm a bit behind, but trying to catch up (either on chatting or getting flagged, not sure which):
The many uses of Fuck

Noun: A good fuck
Verb: Fuck you
Adverb: fuckin' great

To express:

fear: Oh fuck!
happiness: Fuck yeah!
Anger: Fuck you!
Despair: Fuck me.
Excitement: Fuckin' A!
Injustice: Fuckin' shit.

Depression: Fucked again.
Breakup: Fucked Again.
Reunion: Fucked Again!
 
4:58 PM
No one will flag you for that.
Right?
 
@JerryCoffin Before you can catch up, you must throw up!
 
Fear, and surprise!
 
Als
@JerryCoffin: And to express Lust?
:P
 
See depression.
 
Not lust, but intercourse.
 
4:59 PM
@CatPlusPlus Those are the three emotions 'Fuck' can express!
 
@FredOverflow Ew. I don't even.
 

« first day (362 days earlier)      last day (4580 days later) »