« first day (353 days earlier)      last day (4599 days later) » 

10:00 PM
the language semantics of managed languages enforce that they must be slower than equivalent C++ code
 
@DeadMG Well, yes there is. If you do this, it means a class really becomes two entirely different classes with different behavior, depending on how a particular object was allocated.
 
@JerryCoffin That's a problem how? We already have that in C++- it's called being a shared_ptr<T> or not
for example
consider a C# class which has another class as a member variable
in C#, you must indirect
in C++, you can store it as a value and get a virtually free immediate to get the member variable
therefore, C# code must, by definition, take longer to execute member lookups
 
@DeadMG That's a problem because a class is supposed to define the behavior of the objects of that class. With this the class no longer defines its own behavior. shared_ptr<T> creates a new class with its own behavior.
 
the same principle applies to if you want to reference primitive types or define arrays of class types
@JerryCoffin The class never defined the behaviour of how it was allocated and de-allocated.
my system doesn't change that
 
@DeadMG But destruction isn't allocation or deallocation. What you're advocating changes the behavior of the class, not just the allocation. Also, of course, a class that overloads operator new and operator delete most certainly can define how it's allocated and de-allocated.
 
10:03 PM
there is no conceptual difference in the use of gc_reference<T> and shared_ptr<T>
the destructor is called when the class's lifetime is up
@JerryCoffin No class will overload placement new. No class will control whether it's in a vector or a list or a circular_buffer or a concurrent_queue, or a variant or any of a dozen, or a thousand, or a million classes that might or might not allocate it somewhere undefined.
the only difference is that in one of them, the lifetime is up immediately, and in the other, the lifetime is up eventually
 
@DeadMG Yes and no. First of all, there's a huge difference: shared_ptr<T> will (deterministically) destroy an object as soon as there are no longer any references to that object. gc_reference<T> may (non-deterministically) destroy an object sometime after there is no longer any reference to the object -- but it's not guaranteed to run exactly when the last reference disappears, or even ever for that matter.
 
ok
so what's the problem?
 
Second, GC wouldn't change the behavior of some_template<T>, but of T itself.
 
FWIW C++/CLI does support RAII-style deterministic destruction of managed classes.
 
no, it would most assuredly only change the behaviour of gc_reference<T>
T would neither know or care
 
10:08 PM
What's a good cross-platform way to support international languages?
 
the destruction event is generated externally to the class, it always has been, and it always will be
 
Is there a standard way in C++ to support languages that use special characters?
 
whether that destruction event comes from the GC, or a shared_ptr, or a vector clearing it's contents because it was destroyed or cleared itself is irrelevant
 
@IDWMaster C++11 supports the Unicode thingies.
 
Because my string class has already received widespread criticism for not supporting international cultures
 
10:09 PM
@DeadMG The problem is that GC basically just doesn't work for "precious" resources. For something like memory, that's plentiful and fungible, it works pretty well. For things like network connections, database connections, files handles, etc., that are often much more restricted, it works relatively poorly.
 
@RMartinhoFernandes C++ 11 isn't cross-platform though to my knowledge
I know Visual Studio 11 supports it
Don't know of anything else that does yet
 
@JerryCoffin That's why you have RAII as well.
and if you allocate something like a File off the GC heap, then it's your own dumb fault I'm not bothered by the problems you encounter, just like I won't stop people de-referencing NULL pointers.
 
@IDWMaster Er, the black sheep here is Visual Studio. GCC supports most of it, but VS11 is not adding much C++11 support.
 
@DeadMG Technically in C# File is a static class, and can't be allocated on the GC heap
 
10:11 PM
@IDWMaster Whatever. It's a representation, not a literal example
 
Haven't done much C++11! Cool though! It has a multithreading library built in!
 
@IDWMaster There are certainly parts of C++11 that aren't portable (yet). Although it's not (necessarily) Unicode, the current C++ includes wchar_t (and associated functions), that are almost universally implemented as some form of Unicode. The problem (or one problem, anyway) is that it may be (and is) UTF-16 on one implementation, and UTF-32 on another.
 
just like how, right now, in C++, if you allocate off the native heap, and then never free it, it's your own fault
 
{
    FileStream f = File::Open("foo");
    // blah blah
} // f will get closed here.
That's C++/CLI.
 
@JerryCoffin Which is why wchar_t isn't cross-platform
 
10:13 PM
Managed classes with RAII.
 
@RMartinhoFernandes f doesn't get closed there
 
@IDWMaster Right -- and that illustrates the problem. You have to start adding quite a bit of other "stuff" to get the two to play together nicely, and quickly end up with code that's quite a bit different from C++.
 
f stays open, because it was never Close()d or Dispose()d
 
It works off of IDisposable as usual.
 
@JerryCoffin What, the fact that one class is static illustrates the problem?
I still don't actually see what the problem is
 
10:14 PM
I don't like this answer.
I troll all the time
 
The need for static classes is basically a language-level issue.
 
1
A: Flagging fundamentally flawed

Here's my suggestion. Flags should be a way to call attention to serious violations of the rules. For example, excessive use of obscenities or abusive language, spam, and excessive noise. The members of each room can deal with room-specific problems personally through direct communication with ...

 
@IDWMaster Yes, and no. If you're careful, you can use it in a cross-platform fashion, but it doesn't guarantee much.
 
@JerryCoffin This is one thing C++ needs, is a standard international text library
 
@IDWMaster It gets Disposed automatically. It's RAII.
 
10:15 PM
@RMartinhoFernandes No it doesn't. Unless it's enclosed in a using() statement
Which it wasn't in your code sample
 
@IDWMaster I wasn't C#.
It's C++/CLI.
 
Oh. Never mind then.
 
I made a point of mentioning that.
 
Whoops
Forgot the :: instead of .
Why does std::string implement char* instead of wchar_t*?
 
@IDWMaster std::wstring is a string of wchar_t.
 
10:18 PM
so
perhaps we should go back to basics here
 
@DeadMG No -- the fact that to get an entire metaclass (so to speak) of classes to work, you need to write them in a way that's no longer any more than vaguely similar to C++, and you suddenly have non-orthogonal concepts producing non-uniform behavior. Note that my argument was never that you can't do this, only that the result is no longer much like C++.
 
I don't see it
 
I don't see how a static class is relevant.
It's just a hack to get free functions.
 
if you need immediate destruction, use the native heap or stack, if you don't, let the GC destruct it later
 
After reading about RAII for hundreds of times, I finally get what it means. Why people start with construction and destruction instead of the actual scope guarantee (deconstruction at end of scope) is beyond me.
 
10:19 PM
You CAN sort of create a static class in C++
Example:
 
I don't really see how you would do anything differently to how you do it now
 
It's basically a namespace. There's no construction or destruction involved in static classes. In fact, it's forbidden.
 
Just use a private constructor
And no public variables
Or use a namespace
Both methods will produce essentially the same effect, so it can be argued that both C# and C++ have static classes
To an extent
Is there a way to force wchar_t to always use utf32 for example?
 
@RMartinhoFernandes static doesn't mean nearly enough different things yet -- what we clearly need is to add at least a few more different things for it to mean.
7
 
10:21 PM
no
 
@JerryCoffin I agree with your sentiment.
 
@IDWMaster No -- the size of wchar_t is defined by the compiler; if the compiler makes it 16 bits, then it can't possibly be utf-32/UCS-4.
 
man
I ruined some clothes and bedding when I was at university
now my parents are gonna know all about it when I bring them back
 
A C++/CLI static class is ref class Foo abstract sealed {};. Obviously, you only do this in C++/CLI instead of free functions if you want to expose it to the managed world.
 
I really needed to replace them
 
10:23 PM
So is there a way to force the compiler to use one or the other?
 
@IDWMaster No.
 
Is GCC at least consistent?
 
@IDWMaster Not with any compiler of which I'm aware. VC++ makes it 16 bits, gcc 32.
 
If your compiler supports char16_t and char32_t, you're good. Otherwise... good luck :)
 
So GCC will ALWAYS use 32
 
10:24 PM
@IDWMaster At least in all ports of which I'm aware, yes (but I don't work very hard at maintaining awareness of all, or even many, ports).
 
@JerryCoffin GCC uses UTF-32 on both Windows and Linux?
 
@RMartinhoFernandes I'd have to check to be absolutely sure, but I think so, yes.
 
4
Q: How big is wchar_t with GCC?

Chris BeckeGCC supports -fshort-wchar that switches wchar_t from 4, to two bytes. What is the best way to detect the size of wchar_t at compile time, so I can map it correctly to the appropriate utf-16 or utf-32 type? At least, until c++0x is released and gives us stable utf16_t and utf_32_t typedefs. #if...

Juicy info.
 
anyway
I need to sleep now, more than enough worry already happened for this decade
 
Oh right, sleep. I almost forgot that.
 
10:27 PM
nub
 
@RMartinhoFernandes Doing a quick check, I take that back: on cygwin, it seems to be 16 bits, at least by default.
 
@JerryCoffin Haha! I knew it was a mess!
Maybe I shouldn't be happy with that...
 
Does this channel have a set 'OP', or is it assumed that there will never be disciplinary issues in these channels?
 
@RMartinhoFernandes I suppose it's understandable (given that the rest of Windows uses UTF-16), but yes still ugly.
 
@RMartinhoFernandes YES! My compiler DOES support char16_t and char32_t
 
10:30 PM
@CaptainLightning "OP"? It has "owners", who have some administrative rights, and SO moderators who have some as well (and anybody with 10K+ rep can deal with some disciplinary issues as well).
 
Now to see if MSVCC supports it...
 
@JerryCoffin Confirmed it on MinGW too: 16-bits.
 
Be right back.....
 
I guess it would be a pain to work on Windows with 32-bit wchar_t.
 
10:32 PM
@IDWMaster Yes, as of VC++ 2010, it does.
@RMartinhoFernandes Yes and no. If you had the right codecvt facets to convert between UTF-16 externally and UCS-4 internally, it wouldn't necessarily cause a problem at all. The problem is that those are rare (and even when available, almost nobody knows how to use them).
 
@JerryCoffin Right. You say "codecvt facet" and I hear "some stuff from the bowels of the standard library". :(
Maybe I should look into it.
 
@RMartinhoFernandes Theoretically, you should. Practically, it's probably a waste of time. The general idea is pretty good, but the execution has been almost universally useless.
 
back
 
Not really my kind of music.
 
10:43 PM
Grooveshark is a bit shady
 
The idea of codecvt facets is that you have one, "idealized" internal representation for all characters. You then have codecvt facets that can convert between all those external representations (ISO 8859-x, Shift-JIS, UTF-16, UTF-32, etc.) and that internal representation. The problems are that 1) using them is kind of a pain, and 2) your compiler probably doesn't have facets for all the encodings you care about, and 3) writing a new codecvt facet is extremely painful in most cases.
 
Ok, am I correct in assuming this part of the stdlib doesn't come from the same minds of the containers and iterators?
 
@RMartinhoFernandes No, it doesn't. It's quite...different. Frankly, it's a ugly PITA to deal with.
 
Visual studio does NOT support char16_t
 
Figures. It's a pity that some parts of the standard library are not as polished.
 
10:47 PM
Good - The wchar_t type is defined by MIDL as an unsigned short (16-bit) data object.
 
@IDWMaster VS 2010 does.
 
So it's ALWAYS char16_t
Esentially
Visual Studio 11 apparently doesn't
 
The developer preview, you mean?
It should, unless of course, it's buggy.
 
Yes
 
Or make sure you're in C++11 mode or something.
 
10:49 PM
@RMartinhoFernandes Microsoft "deprecated" a bunch of features in Visual Studio 11
Including fopen, which is now "forbidden"
It exists, but it's "forbidden" to use
 
Are in you in WinRT mode or something?
fopen is not forbidden, unless you're using WinRT.
 
@IDWMaster u can turn off the idiocy. I think it's like #define TURN_OFF_MS_IDIOCY
4
 
@AlfPSteinbach You can, but you can't publish your apps
 
@IDWMaster I doubt they deprecated char16_t though (it's brand new, and there's no reason to deprecate it at all). If it's not working, that's a pretty clear bug.
 
I thought you were going cross-platform or something.
That publishing thing is just for WinRT.
 
10:54 PM
@RMartinhoFernandes True. Then again, it took decades to come up with anything as clean as the standard containers and such. If you can come up with a way of handling i18n that's as polished (and write it up in a way the committee can possibly accept) I'm pretty sure they'd love to include it in the next standard.
I, unfortunately, am not sure I have any good ideas of how to do it nearly that well.
 
I think I'm abusing this "... or something" expression or something.
 
How do you get Eclipse to compile C++11 code
@RMartinhoFernandes I am, but that includes supporting WinRT
 
@JerryCoffin And I don't think I have enough knowledge of the matter to do anything.
@IDWMaster Then that basically means writing something crippled by the restrictions of WinRT and not able to use any of WinRT.
 
@RMartinhoFernandes Sort of.
 
To me that sounds like torture.
 
10:57 PM
@RMartinhoFernandes It's bad, but it's not torture
The guys that made Mono probably had to deal with this as well
 
@IDWMaster Dunno, somewhere where you pick the compiler options. You need -std=c++0x.
@IDWMaster Not really.
They didn't have a crippled environment.
They could use fopen if they wanted.
(Though they probably went with just open)
 
@RMartinhoFernandes It sounds to me like a good place to use a decent library. Have the Qt people said anything about targeting WinRT?
 
Hmm, no idea.
 
error: 'char16_t' was not declared in this scope
 
In any case, it's most certainly not ready.
 
11:04 PM
Got it to work in Eclipse!
Note: The Console class will not be supported in Windows 8, as all related C++ functions are deprecated
Wow!
What a mess!
 
Right, so it's half-cross-platform.
 
@RMartinhoFernandes It
It's a work in progress
 
Do you know that you can still have the Console class working?
By itself it doesn't require any of those deprecated functions.
 
I can, but it's kind of pointless because it can't actually do anything
 
It can do everything it does.
 
11:07 PM
I could redirect all input to a "black hole"
Windows 8 apps are entirely GUI-oriented now
 
Basically Console provides: access to the standard streams (and ways to swap them for other streams), and shortcuts for writing/reading to them.
The standard streams of a GUI app have always been black-holes (even before WinRT).
 
Unless you build it as a Console app
And run it with a GUI
 
That's not an option now, is it?
 
@RMartinhoFernandes It's not an option any more
 
Right. So Console is perfectly viable.
 
11:10 PM
I really like the new Thread class!
 
As a user of your library I want my code with Console::WriteLine("Foo"); to compile. Because I can do something like this: Console::SetOut(File::Open("foo")); before.
 
OK
I will implement that now!
 
First I will implement a StreamWriter class
 
@AlfPSteinbach Is that relevant to something, or just posting random stuff?
 
11:13 PM
fandom stuff
 
@AlfPSteinbach One more reason NOT to use gotos, or you will be attacked by a giant dinosaur.
 
:)
@IDWMaster It's not a giant dinosaur! It's a velociraptor!
 
Same thing
 
Not the same thing.
Now that I look at it, the analysis of this building is flawed. "Outer door: secure"? Velociraptors can open doors!
Velociraptors are scary things. They scared me a lot more than the big T-Rex in Jurassic Park.
Hmm, it's been over 18 years now.
 
Any way to implement properties in C++ (the syntax)?
 
11:24 PM
Don't think so.
 
@IDWMaster yes, but it's inefficient, and properties cause bugs and confusion, so don't.
 
OK. I won't
 
@AlfPSteinbach How would you write them?
It would be painful, right?
(I'm not talking about auto-properties, but properties in general: i.e. special syntax for arbitrary get/set function pairs)
 
@RMartinhoFernandes not very painful. the simplest property is a public member variable that has an internal pointer to the containing object, and provides custom assignment and conversion operators.
^ funny
 
@AlfPSteinbach But other than auto-properties, you would need one such proxy class for each property.
 
11:28 PM
@RMartinhoFernandes no, just template it
 
And write a specialization for each? Not much of an improvement.
 
what's an "auto-property"?
@RMartinhoFernandes huh, why on earth would you do that
 
Auto-properties are the stupid kind of property: getter/setters that do nothing other than expose a private member variable.
 
By the way; why does this no longer compile in C++0x?
&refcount = &refcount+1;
Compiled before
 
11:33 PM
As a contrived example you can have int Foo { get { return ComputeFoo(); } } and int Max { get { return ComputeMax(); } }.
prop<int> Foo; prop<int> Max; would not do it.
@IDWMaster Why do you want that to compile?
 
@RMartinhoFernandes I have an int* and I want to increment the value specified by that pointer
 
If that compiles, it does effectively nothing, and I rather have it not compile.
@IDWMaster But do you have &refcount = &refcount+1; or p = p+1;? Not the same.
 
Meant
 
@RMartinhoFernandes like, if it doesn't support desired feature, add support. but better not use properties.
 
* not &
 
11:35 PM
@AlfPSteinbach Right.
@IDWMaster Ah, ok.
Given int* refcount;, *refcount = *refcount + 1; should compile.
 
Just made a typo
That was it
By the way; why is malloc included in string.h?
Seems like an odd place to put it
 
Er, that's a shortcoming of the C++ compilation model.
But more importantly, why are you using malloc?
 
What's wrong with malloc?
 
It's worse than new.
Compare new T with (T*) malloc(sizeof(T)).
 
Yeah. I guess the code doesn't look as clean
 
11:42 PM
Not just that.
It doesn't call any constructors.
(Though sometimes you don't want that.)
 
In my case, calling a constructor isn't necessary
But I guess it still looks cleaner
I was just allocating memory for an int
So I was doing (int*)malloc(sizeof(int));
See what the problem is though
I'm cleaning up my code
 
@Alef thanks for the Monty Python link, needed a good laugh. Now they need to make a Monty C++ :P
2
 
@JoshuaSmith Wonder why they don't have a Monty C++ yet?
 
The Alef programming language was designed as part of the Plan 9 operating system by Phil Winterbottom of Bell Labs. In a February 2000 slideshow, Rob Pike noted: "…although Alef was a fruitful language, it proved too difficult to maintain a variant language across multiple architectures, so we took what we learned from it and built the thread library for C." Example This example was taken from [http://doc.cat-v.org/plan_9/2nd_edition/papers/alef/ref Alef Language Reference Manual]. The piece illustrates the use of tuple data type. (int, byte*, byte) func() { return (10, "he...
 
@IDWMaster !programmer.skills.contains("Comedy TV Production")
 
11:52 PM
@JoshuaSmith Nice one. Now I need to make a Contains() function for my array class!
 
@IDWMaster sorry, didn't debug that message, but yes I have extended vector with .Contains before
 
This may be a stupid question, but how do you pass a parameter to a std::thread?
 
Avoid std::thread if you can.
 
Why?
 
It's too low-level.
 
11:56 PM
Are the platform-specific implementations better?
What's too low-level about it?
 
std::future, std::async and std::packaged_task are better. (And I believe std::packaged_task has that feature you asked about)
 
We really dont need a programming language called alef. Theres way too much politics and mathematics to it.
 
Obviously, if you do need low-level, then use low-level :)
 

« first day (353 days earlier)      last day (4599 days later) »