« first day (112 days earlier)      last day (4819 days later) » 
00:00 - 21:0021:00 - 00:00

9:00 PM
secondly
because you can have variable-length classes, and allocate them with custom allocators
whereas your approach depends on using only the pre-provided heap allocation
 
What can sizeof(class) possibly yield if different objects need different amounts of space? :)
 
an error
just like doing class() if class doesn't have a default constructor
 
Aha, so in a template, sizeof T can be an error? :)
 
that's what I made concepts for :P
 
How would I define a vector<T> then?
 
9:01 PM
you can't
 
A language without vectors doesn't sound very useful.
 
just because the new semantics don't make sense in every situation is no excuse not to use them
well, the vast majority of normal classes will have a compile-time sizeof
sizeof() is not a run-time operator now, it is a run-time operator now if the class author chooses to overload it to make it so
 
What if the compilation unit using sizeof(T) doesn't know about the sizeof(T) overload? UB?
 
compilation unit? what compilation unit
they're very gone
the first thing I cut
 
You really need to write some documents people interested in your language can read.
 
9:04 PM
truth be told, I didn't expect that anyone would be interested in it
 
:D
I simply see that it's hard to discuss the language with all your implicit knowledge that others don't share (yet).
 
it is
more than that
the more I learn about C++, the more I realize that I cut by virtue of not knowing or forgetting that it existed in the first place
I was going to completely redesign the IOStream library, and then I realized that I was completely unfamiliar with the vast majority of it's functions
 
remember the C and C++ standards account for an extremely wide variety of platforms, even desktop systems with segmented architectures so you have near and far pointers
 
indeed
and that I certainly will not
 
@FredNurk Are near and far pointers standard?
 
9:07 PM
DeadMG++ is intended for systems above a certain size
and frankly, if you can't afford to turn exceptions on, you're using the wrong language
which means that I'm going to be pretty ruthless about anyone complaining that they can't make it run on their toaster
unless they made one hell of a toaster
 
Are there perhaps modern alternatives to exceptions? Optional types, maybe?
 
no
for a start, you'd run into a mess with types like references
 
@DeadMG On my toaster, resource management is manual. I have to garbage collect the crumbs regularly :(
 
lolo
 
@FredOverflow almost, but no; there are lots of things which makes using them easier, like nested typedefs, iterator_traits, ptrdiff_t, size_t, …
 
9:10 PM
Why would I want to program toasters, anyway?
 
if you're actually genuinely interested, I could put together a small document
 
@FredOverflow but this is why, for example, you cannot compare two pointers unless they point inside the same array
 
Did anyone else ever program in OpenGL and stumpled into the "float near = some_value; float far = some_value;" pit and got strange compiler errors? :-)
 
one of the things I was going to cut, actually
 
@FredOverflow macros are evil
 
9:11 PM
I suggested that if you have two pointers, then comparing them is always defined behaviour- even if the return value was undefined
 
@DeadMG First I would like to see code examples that demonstrate how your language makes typical programming problems easier.
 
are you kidding? I'm not even finished with half the features
 
@FredNurk A rule not every C++ programmer is familiar with...
 
more to the point, the basis is pretty similar to C++, if you asked me to demo quicksort it would look pretty similar
 
7
Q: checking if pointer points within an array

FredOverflowCan I check whether or not a given pointer points to an object within an array, specified by its bounds? template <typename T> bool points_within_array(T* p, T* begin, T* end) { return begin <= p && p < end; } Or do the pointer comparisons invoke undefined behavior if p...

 
9:13 PM
what's interesting, though, is an implementation still has to allow std::less, et. al. to compare them
 
well, at least, I would use an extension on the range
 
@FredNurk Yes, see the question I just linked :)
Will DeadMG++ have closures?
 
I'm pretty happy with lambdas as they are in C++0x
and see little reason to change the system, except that they cannot be templated, which is an irk I may consider looking at
 
Does DeadMG++ have (optional) garbage collection?
 
I've been considering it
but the problem is that I will not accept any solution in which UDTs cannot be natively allocated on the stack or heap
 
9:15 PM
Optional gc didn't make it into C++0x, right? :(
 
implementing a collector to collect a language is one thing, but it becomes a lot more complex when you have to consider that GC references may exist inside native types
or, even if you ban it, the complex interaction rules that would result
it did, insofar as, it is now implementation defined whether or not dynamically unreachable objects are collected
but as a programmer, I have no options
the other trouble I came up against when considering garbage collection is code which is compiled to assume a GC would basically have to run against one to function properly- even if it was compiled into a program expecting non-GC
 
Language design is difficult :)
 
ultimately, I think that it's about the market that I'm aiming for
that is, people who need very high control of everything that's going on
and the compiler to enforce that control to it's reasonable max
for example
I decided that it would be legal in DeadMG++ to create a whole lot more with templates
 
So your target audience is frustrated C++ programmers which haven't already converted to D? ;)
 
including templated virtual functions and even templated member variables
D doesn't target the same audience- it has GC just like Java or C#
 
9:21 PM
GC is restricted to class types in D.
 
how useful
I only define pretty much everything I need as a class
 
Well, you could use struct, which is not gc'd :)
 
heh
I considered making that distinction, personally
but I'd be confused as to how the two would interact
 
That's how it's done in D.
 
if you have a class with a struct member, then what? now the GC has to track virtually all pointers and mutations
and I'm not really seeing how that's going to lead to something that's more efficient than what we already have
although it would sure make creating relatively trivial programs easier
 
9:26 PM
@FredOverflow: your question led me to ask stackoverflow.com/questions/4909766/…, as one of the answers to yours uses ==
 
@FredNurk I'm pretty sure equality is well-defined on all pointers of the same type.
 
it's a nitpick and probably not valuable in practice, but consider two near pointers
if they point to different segments but at the same offset, would they compare equal?
I don't see how the compiler/language could detect this case, except by disallowing ==
 
very glad that segmentation is not in x86 anymore
 
oh, it still is
we just don't use it :)
 
ok
I'm pretty sure that technically, x86 still has like, a segment register and stuff
but I'm pretty sure that it's been realistically unused since x86-32
 
9:37 PM
also, there's newer forms of segmentation, like PAE
 
sure, but how common really is PAE?
 
"PAE is provided by Intel Pentium Pro (and above) CPUs - including all later Pentium-series processors (except the 400 MHz bus versions of the Pentium M), as well as by other processors such as the AMD Athlon and later AMD processor models with similar or more advanced versions of the same architecture." en.wikipedia.org/wiki/Physical_Address_Extension
it's only needed when you have more than 4GB of ram, and that has previously been much less common than not
 
sure, but the same article says that Windows doesn't use it
 
and it seems 64-bit will become more commonplace than x86 with >4GB
 
indeed
 
9:42 PM
windows doesn't support >4GB of ram on x86, iirc
"Microsoft Windows implements PAE if booted with the appropriate option"
"some drivers were found to be unstable when encountering physical addresses above 4GB" => segmented programming is hard :P
 
and it also says that user-mode processes can't access it anyway
so effectively, programmers do not have to use segmentation, even if the OS is using PAE
I actually don't even have a clue how to use segmentation
seems to me like 16bit segment register + 16bit pointer = just go to 32bit
 
userland programmers
e.g. see the quote about drivers
 
indeed
I'm going to bet alot of money that most programmers are in user land
 
@DeadMG "User land" sounds like an amusement park.
 
lol
 
9:47 PM
In "Kernel land", you must build your own rides!
 
lol
well
I'm gonna try to go to sleep
have fun
 
@FredOverflow it usually is
@DeadMG and the most important work which allows userland programmers to do what they do is itself not in userland :)
 
user379888
10:12 PM
Do we also separate the function definitions like we separate the class declaration in a separate header file?
 
user379888
What is the name of this operator --> ?
 
there is no --> operator
there are -- and > operators, as well as a -> operator
a-->b is (a--)>b
 
user379888
When we access with the help of pointers we use this '-->'to access it instead of a dot operator
 
sbi
@FredNurk Well, I bet a-->b compiles, so there must be a --> operator.
 
user379888
Even if it is not an operator,does it has no name?
 
sbi
10:22 PM
@fahad No, you use the -> operator.
 
2 mins ago, by Fred Nurk
a-->b is (a--)>b
 
sbi
@fahad: (And my statement was a repeating a joke ISTR @Johannes(?) once made.)
 
user379888
-> == --> ?
 
@sbi I think it was GMan that had that joke question, but could've been litb
@fahad no
 
sbi
@FredNurk Oh my. I should leave. I'm no good tonight.
 
user379888
10:24 PM
Then?Why did you told me to use -> instead?
@sbi:Good night : )
 
@fahad I didn't say to use -> instead, I said there is a -> operator
 
10:39 PM
@fahad No. a->b is the same as (*a).b, and a-->b is the same as (a--)>b (read: decrement a and then check if the old value of a is greater than b).
535
Q: What is the name of this operator: "-->"?

GManAfter reading "Hidden Features and Dark Corners of C++/STL" on comp.lang.c++.moderated, I was completely surprised that it compiled and worked in both Visual Studio 2008 and G++ 4.4. The code: #include <stdio.h> int main() { int x = 10; while( x --> 0 ) // x goes to 0 { ...

 
 
1 hour later…
11:43 PM
@FredOverflow Yes, it's the "goes to" operator, primarily used for unsigned loop variable in for loop. The example given is not a good one since it uses int. I first learned about "goes to" from a Usenet posting by Andrew Koenig; he has a thing for jokes based on novel interpretations of words and also C++ code...
 
would you say Andrew looks things up, i.e. understands, differently from the rest of us?
 
@AlfPSteinbach Well, then let's make that thought explicit:
#define GOES_TO -->
 
@FredNurk i think he's just way smarter than most of us (including me), so, yes :-)
 
#define GOES -- // #define TO >
 
@AlfPSteinbach Andrew Koenig invented Koenig lookup. How smart was that? ;)
 
11:51 PM
@FredOverflow i think that was a slight mistake. but he also added value initialization in c++03. good work.
 
If you have a condition / parameter list with a large number of operands / parameters, how do you indent that?
 
@AlfPSteinbach Is there a paper on value-initialization that discusses its motivation?
 
Is there a general consensus how that should be indented?
 
@72con I make it a single unsigned int and use bitmasks ;)
Then you get "named parameters" for free ;)
Of course that only works for up to 32 parameters, but I never exceeded that limit.
 
@FredOverflow no, not AFAIK, but it's well known: Make Things Work the way you expect them. it's counter-intuitive that by adding a std::string member, say, you suddenly get different initialization semantics (as it was in c++98). that was the motivation.
 
11:52 PM
let's assume there are 6..
*64
 
@AlfPSteinbach Oh, interesting. Did that influence the initialization of other members in C++98? That's how it sounds.
@72con unsigned long long int.
 
err..
 
@72con Above 64, you could use std::bitset<n>... but seriously, refactor?
 
:))) ok, but let's say that you have parameters / conditions that are not ints. How would you indent the following..

if (freakingLongMethodCall1() || freakingLongMethodCall1().getsFreakier() || freakingLongMethodCall1().getsFreakier().thisIsJustSick() && noneOfTheAbove(), ...)
I'm talking multiline conditions..
how do you indent them with respect to the line with the if
 
@72con I wouldn't write code like that in the first place. How about this?
bool a = freakingLongMethodCall1();
bool b = freakingLongMethodCall1().getsFreakier();
bool c = freakingLongMethodCall1().getsFreakier().thisIsJustSick();

if (a || b || c)
 
11:58 PM
@FredOverflow yes. different treatment of POD and non-POD aggregate. with POD a default-initialization like T() gave you zero-initialization, but with non-POD it gave you call of default constructor, by §8.5/5. In c++03 T() gives you value-initialization instead.
 
I know.. but sometimes you just do have multiline (say it gets as long as2 lines) conditions. How do you indent that w.r.t. he line with the if keyword?
 
00:00 - 21:0021:00 - 00:00

« first day (112 days earlier)      last day (4819 days later) »