« first day (445 days earlier)      last day (4495 days later) » 

4:02 AM
:2272472 Right, that tells me they compute partial derivatives and take a genType parameter (that is, basically anything).
You usually compute partial derivatives of functions.
How the heck do I pass in a function?
 
Yea, I kind of realized that as I posted :/
 
From the few samples I've seen, it appears that they're magical. You just put some expression inside the parenthesis and that is magically treated as a function.
I guess I'll crack the spec open and look for this.
 
Yea my continued searches are turning up some confusing results
@RMartinhoFernandes Did you see this? java-gaming.org/index.php/topic,21089.
Even if the discussion isn't helpful it mentions several papers that might be useful
 
4:19 AM
Yeah, seems like that's it. You do dFdx(blah) and it will get you the difference from blahs on neighboring fragments.
And the expression can be as complicated as you wish, as long as it doesn't use another derivative.
I guess I can use this to do bump-mapping with an heightmap instead of a normal map.
 
Is that what you wanted it for in the first place?
 
No, I just found them in a list of functions and got intrigued.
 
Ah
I have a new GPU being delivered the mail sometime soon. I haven't written anything for one before, but I'm excited to start trying out CUDA.
 
If I get a job soon, I'll buy a new machine and include a decent GPU. I really want to play with the cool stuff I'm missing. Oh, and maybe some games too :)
 
Xeo
3
A: Array placement-new requires unspecified overhead in the buffer?

Howard HinnantDon't use operator new[](std::size_t, void* p) unless you know a-priori the answer to this question. The answer is an implementation detail and can change with compiler/platform. Though it is typically stable for any given platform. E.g. this is something specified by the Itanium ABI. If you ...

 
4:31 AM
@Xeo So it really is useless (and not a defect).
 
@RMartinhoFernandes Not sure what kind of games you like, but I highly recommend The Witcher 2 once you get your new machine
 
Thanks, I'll look it up.
How much consideration do you guys give to adding noexcept to your signatures?
I never remember that (well, except for swap).
 
@RMartinhoFernandes It's news to me, but I like compile-time safety :p
 
5:00 AM
@robjb Seen recommendation for that a lot.
 
@StackedCrooked It's extremely well done, but it was graphically tasking on twin 8800 GTXs (and I was on medium settings)
Then both cards died within a few weeks of each other, a month or so ago (they were nearing 4 years old)
The storytelling is probably one of the better parts... its world size is nothing like Skyrim, but the story isn't linear by any means, the visuals are probably the best this year, and its gameplay mechanics are polished to perfection.
 
5:19 AM
is there any circumstance where the compiler generates an operator==() ?
oh fuck wait
no i'm stupid
 
struct X {
    // ...
    operator Y*();
};

// ...
if(x0 == x1)  // no error!
made me wonder for a moment
:-S
 
And Y has operator==?
 
a pointer, sorry
 
See, I told you implicit conversions are bad :)
 
5:22 AM
lol
i deserved that
 
5:35 AM
@robjb Is it similar to the Witcher I? I tried that one but found the combat system a little weird.
 
@StackedCrooked I saw my brother playing that after the fact and its combat system looked weird, haven't played it myself... but the Witcher 2's combat is very fluid.
 
Cool. I think I might check it out then.
Haven't found a game since Dragon Age Origins.
 
@StackedCrooked I liked that one too, but never managed to finish it
Forgive my ignorance, but parashift.com/c++-faq-lite/operator-overloading.html#faq-13.1 says ^ works for the-power-of except for precedence and associativity
How is bitwise XOR anything like the-power-of?
 
I have over 300 hrs of playing time according to Steam. I've spent a crazy amount of time on that game.
 
@StackedCrooked I have close to 400...
 
5:40 AM
Haha don't think I've put that much time into a game since FFX, or UT2004
 
@Mysticial On Dragon Age?
@robjb I didn't expect to become addicted to a single player game.
 
@StackedCrooked Don't try Skyrim
 
@StackedCrooked L4d and l4d2 combined
 
I had it for almost a week before my GPUs died and productivity dropped quickly
 
Hehe. Haven't played it yet.
 
5:42 AM
@robjb It means you can overload it to mean that, but precedence and associativity make it awkward to use.
 
@RMartinhoFernandes Ohh. That makes more sense.
 
LOL
 
 
1 hour later…
6:54 AM
Feel bad for the developer. He's the only person in the company who isn't a "chief" or "officer"
 
@Pubby That looks just like a lot of lorem ipsum.
 
@RMartinhoFernandes Don't forget the copious amounts of Apple products.
Hmm, wonder why this happened: Connection refused
 
I answered the latest C++ question:
1
Q: how to implement listbox?

buddyI'm trying to develop a winform in vc++ How to implement a listbox with 3 columns(file name, created by, size) in win32 application and add filename(when i click on it it opens the file) and created by values to it?

 
7:10 AM
INITCOMMONCONTROLSEX, lol
i.imgur.com/PgEem.gif Stare at the plus sign for a while.
2
 
7:59 AM
mawning
can anyone give me an idea how you'd emulate 8 bit floating point precision with just integers?
 
floating point?
 
I was doing that yesterday actually
decided it was a very bad idea
 
oh maybe it was fixed point
 
Oh, that's much easier
 
Easy.
Addition is just addition.
 
8:03 AM
Subtraction too. Multiplication shift the result to the right. Division shift the numer to the left.
 
oh right
hmmm, in this code I'm looking at they are shifting the addition 8 bits to the right
 
That doesn't make much sense.
 
Maybe it's really a shift (i.e. division by 2^8)?
 
blk[0] = (x7+x1)>>8;
where x7 and x1 are ints
 
Maybe x7 and x1 are the result of multiplications without shifts (to keep some extra precision in the addition)?
 
8:11 AM
hmmm yea there is multiplications earlier where the result is placed in these int
and indeed done without shifts
 
There you go.
x7 and x1 are stored with 16 bits of precision, and the addition is made with those 16 bits, and then the result is brought back to 8 bits.
 
right
 
What are the rules for shifting signed ints? Is 1 >> 1 UB?
 
They are more UB-y than unsigned ints. Not sure about that particular case.
@Pubby Only shifting negative values seems to be undefined.
 
What's defined way to shift negative?
Is there one?
 
8:18 AM
There isn't.
 
Hm, suppose multiplication/division could work
despite the rounding differences
 
@Pubby x = (n < 0? y>> -n : y<< n)
 
Oh, I meant the value being shifted, not the amount it's being shifted by.
 
Yeah, I meant -1 >> 1
 
I.e. in x >> y, x cannot be negative.
y can't either, even for unsigneds.
 
8:20 AM
ok, it's well defined for non-negative, and in practice also well defined for negative
on (nearly) all implementations -x is represented as 2^n-x where n is number of bits
 
Anyway, if you're thinking about a fixed-point class, I'd store it as unsigned and treat as two's complement.
 
and on (nearly) all implementations there is no trapping
 
@AlfPSteinbach But do all implementations do the same kind of shift (arithmetic vs the other kind)?
 
morning
 
0b1111 >> 3 gets me 0b0001 or 0b1111?
 
8:22 AM
you get arithmetic shift for signed integer type, and logical shift for unsigned
in the case of left shift they're the same
 
but pedantically formally it's at least implementation defined behavior to shift a negative value
 
oh
that's harsh
 
@RMartinhoFernandes bit shifts shift in a 0 bit, so 0001
 
8:24 AM
@thecoshman Some shifts are sign-extending (arithmetic shifts).
 
Why can't floating point math happen at compile time?
 
@Pubby example?
 
1. no guarantee 2. no way to use in template parameters
 
@AlfPSteinbach Right shifts are implementation-defined, but left shifts are undefined.
 
huh?
weird
 
8:26 AM
@Pubby Cross-compilation would make any attempt touchy I imagine.
 
ok that they don't like possibility of sign bit changing, but i don't see why that could not be very easily defined by implementation
 
@LucDanton Yeah, but it just feels like an artificial restiction
 
@RMartinhoFernandes so... you can't really rely on them to do anything...
 
@thecoshman Just to make this clear, we're talking about shifts from a negative value. Shifts from positive values are well defined (except some corner cases).
 
@RMartinhoFernandes but I thought a bit shift was based purely on the bits, why does it care what meaning those bits have?
 
8:29 AM
@thecoshman The idea is to maintain the fact that shifting right is like dividing by powers of two and shifting left is like multiplying.
 
@RMartinhoFernandes oh I see...
 
If you have 0b1111 (-1 in two's complement) and do a logical shift right of 1 you get 0b0111 which is 7.
Or something. I have the impression I got some value wrong in there.
 
seems right
 
The standard leaves most those things undefined or implementation-defined because it doesn't mandate a representation for negative numbers.
GTFO spammer.
1 message moved to bin
 
But I want to know what the surprise is :(
 
8:39 AM
@RMartinhoFernandes huh... you can star these
he he he
"If Java had true garbage collection, most programs would delete themselves upon execution."
 
user142019
Not only with Java.
 
Yeah, C++ too.
 
user142019
I'm downloading VS 11 Express. What is Expression Blend?
 
It's a GUI designer for WPF.
 
@WTP is that the technology preview or a new version?
 
user142019
8:48 AM
@AlfPSteinbach Comes with the Windows 8 preview. msdn.microsoft.com/en-us/windows/apps/br229516
 
user142019
@RMartinhoFernandes cool.
 
oh i don' have an extra machine
 
user142019
I have VirtualBox.
 
well i have virtualbox. i run ubuntu in it. can it also run windows 8?
 
user142019
I'm not sure. VMware Fusion does. VirtualBox should run it too.
 
8:50 AM
I don't think you need Win8 to run VS11.
 
user142019
But I can't guarantee that :P
 
user142019
You do need it to create Metro apps for Windows 8, at least.
 
Yeah, that.
 
@RMartinhoFernandes i have the vs11 preview installed. but it's just a preview. lots unimplemented
 
user142019
Does VS 2010 run on Windows 8?
 
8:51 AM
@AlfPSteinbach wrong way around :P and yes, it should run win 8
 
@AlfPSteinbach I don't think VS11 brings much in terms of C++ (unless you count the C++/CX thing).
It brings neat toys for .NET though.
async is really cool. I need an idea to play with it one of these days.
 
user142019
There is a new Windows API for C++, C#, and VB called WinRT.
 
Yes, that's the C++/CX thing.
(You can't do WinRT with normal C++)
 
user142019
ah
 
It uses some magic handle things that could really just be a smart pointer class, but well, they decided to make language extensions instead.
 
user142019
8:56 AM
I hope it still possible to use C++ libraries like boost and C libraries like SQLite.
 
I think so. I believe it's pretty similar to what you have now with C++/CLI: all the existing power of C++ (well, at least the parts MSVC implements), and extensions to handle .NET.
 
user142019
I'll use .NET primarily for the GUI.
 
From what I've seen you can easily do GUIs from C++ with WinRT (it's practically the same as from a .NET language)
 
user142019
Also with a GUI designer?
 
@WTP yeah, with the usual XAML designers
 
user142019
9:00 AM
Ah Metro uses WinRT.
 
@RMartinhoFernandes well, you sort of can, if you're willing to write a ton of COM boilerplate code
 
@jalf A ton? Are you sure you don't want to use a bigger unit of weight?
 
megaton?
 
It's incredibly massive.
Black hole kind of massive.
 
user142019
It's silly you can't use C++ for mobile app development (Windows Phone 7).
 
9:02 AM
@jalf I'm wondering how long it will take until someone writes a "WinRT with actual C++" library.
 
@RMartinhoFernandes interesting fact: a cubic light year of cheese would collapse into a black hole
 
ahh.... compiling... time to slack of :D
 
@jalf Hehe, I saw that too :)
 
user142019
Yummy cheese.
 
A cubic light year of cheese has more energy than our sun.
 
user142019
9:04 AM
What if you have a cubic light year of Swiss cheese?
 
lol, that's exactly how the article ended: with a disclaimer that the math was only valid for fully solid cheese and Swiss cheese would need different calculations.
 
user142019
In Dutch we call it hole cheese. Because it has holes.
 
Makes sense.
 
user142019
But I like brie. Brie is the best cheese.
 
What about cazu marzu?
 
user142019
9:07 AM
"Cazu marzu" is Sardinian for "rotten cheese". I don't like that.
 
Casu marzu (also called casu modde, casu cundhídu in Sardinian language, or in Italian formaggio marcio, "rotten cheese") is a traditional Sardinian sheep milk cheese, notable for containing live insect larvae. It is found mainly in Sardinia, Italy. Derived from Pecorino, casu marzu goes beyond typical fermentation to a stage most would consider decomposition, brought about by the digestive action of the larvae of the cheese fly Piophila casei. These larvae are deliberately introduced to the cheese, promoting an advanced level of fermentation and breaking down of the cheese's fats. The te...
As if rotten was the worst part.
 
user142019
Borat had cheese made from human milk in his movie. Though I think it was fake.
 
@RMartinhoFernandes I didn't remember the name but I had an inkling it was that cheese lol.
 
@LucDanton I never remember the name but I know I can google for "cheese larvae" and get it as first result.
 
Oh thanks for that tip. That might come in handy some day.
 
9:12 AM
You never know when you may need to gross someone out on the Internet.
 
user142019
Man the download goes 406 KB/s. I want world wide fibre channel.
 
user142019
This is way too slow.
 
lol, kids these days. In my time we were happy if we got a tenth of that.
 
user142019
lol
 
user142019
Ten years ago we had dial-up. That sucked.
 
user142019
9:18 AM
The best thing about Metro is that icon design is finally doable for a programmer.
 
Ten years ago I was playing around with my Moon Landing game in Pascal. Probably refactoring it after learning about this magnificent thing called "functions".
 
user142019
lol
 
@RMartinhoFernandes surely it's not that hard to work out the average density of Swiss cheese... I would guess at about 75% solid cheese
@RMartinhoFernandes oooh, they sound smart, what are they?
 
9:36 AM
Does friending a template class cause instantiation?
 
user142019
 
Ah, seems like it does.
 
I can see this happening :P
 
can anybody answer this question? stackoverflow.com/questions/8724498/…
 
user142019
No. It's closed.
 
user142019
9:43 AM
You can't answer closed questions.
 
What is the question exactly?
It seems like you can just do template<> struct myInhStruct<X, Y> and write the specialization.
If there's something more to it you should put it in the question.
 
not actually
the problem is that struct is inherited
 
template<>
struct myInhStruct<X, Y> : myStruct<X, Y> { /* things go here */ };
Like this?
 
I tried to do it this way but compiler doesn't allow it.
 
9:48 AM
0
Q: How does this implementation of 1D IDCT work?

Tony The LionI have an implementation of a Inverse Discrete Cosine Transform and I'm trying to figure out how they got to this code. So far, I've figured out that this is probably an optimized implementation of the Cooley-Tukey radix-2 Decimation-in-time for a DCT instead of a DFT (Discrete Fourier Transform...

meh I thought I'd ask, I'm lost
 
@Alex You should have mentioned that in the question, including the error message. As it is your question doesn't really describe a problem that needs solving, and that's why it was closed. If you edit that in we can reopen it and you can then get your answer :)
 
Thanks I'll try. Just didn't wanted to overload a question with a details.
 
Details always help :)
 
@TonyTheLion have you filled it in with numbers so you can see what values it is using
 
As long as you don't post a wall of code, of course.
@TonyTheLion Ugh, if that's fixed point that code does each thing with a different precision. I don't know if that will make it faster, but it certainly does make it hard to read.
 
9:53 AM
@Alex it often doesn't hurt to dump code into pastebin (or something of that ilk) and then link to it; this is especially true when you have little idea where the problem is.
 
@RMartinhoFernandes well I definitely agree that it's hard to read...
 
I don't see x3 being initialized.
 
x3 = blk[2]
 
@thecoshman well I've stepped through it with a debugger
 
Oh wait, it's in the condition of the if...
Sigh.
 
9:54 AM
and yes I can see numbers
 
I usually don't look for assignments there :)
 
though they are fairly meaningless
 
hi
 
@RMartinhoFernandes yeah, assignments in conditions dodgy ground...
wait... in C++ do you have both | and || I thought it only had the one...
 
yes you have both
logical or and bitwise or
 
9:56 AM
@TonyTheLion You should divide (but float division) them by 2^precision to make them more meaningful. And find what the precision is at each spot :(
 
logical = || and bitwise = |
 
oh yeah :P
in Java, the single can be used for both bitwise or logical, but || works slightly differently to |
 
You sure about that?
I'm pretty certain || in Java only works for bools.
 
@RMartinhoFernandes in Java? yeah.
@RMartinhoFernandes yeah, || only works for bools, but | can be used as both bitwise or boolean
you can use logical operators in two ways. one is called short cicuits, such that (true | function()) will not call function(). the other will always call function
and yes, that is a poor explanation :P
 
| can used on bools in C++ as well.
 
9:59 AM
@RMartinhoFernandes but that works as a bitwise still doesn't it?
 
And there's just one bit.
 
@thecoshman On bools you can't tell the difference.
 
@RMartinhoFernandes touchè
 
Well, you can, but that involves UBs.
 
user142019
Are there machines that can directly address individual bits in memory?
 
10:04 AM
@WTP possibly... practically probably not... why?
 
user142019
@thecoshman The C++ Programming Language mentioned it. I was wondering if it's common.
 
@RMartinhoFernandes I have edited the question. Possibly now it's more clear.
 
@Alex I've voted to reopen. It seems that you are possibly missing an #include.
 
@RMartinhoFernandes Which one? All is defined in the same file and namespace
 
@Alex Hmm, the example code you posted compiles fine: ideone.com/PNedG. There's probably something else going on. Can you make a small example that causes the same error?
 
10:11 AM
Will dynarray be adapted into the C++ standard? Does the VC++ compiler have any tricks in this corner? open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2648.html
 
Also, tell us what line are the errors at.
 
boost C++ now! confernce.
Aspen CO, USA, May 14-18, 2012, www.cppnow.org
 
@user800454 The next C++ standard won't be published before 2016. The latest one doesn't have dynarray.
 
@R I see so better to stick with the stndard library containers then for now.
 
@RMartinhoFernandes you mean the output numbers in blk array?
 
10:14 AM
@TonyTheLion Well, it should help for any fixed-point number you have in there. The problem is that each multiplication without shifts increases the precision, so not all stages use the same precision.
Dividing (again, not integral division) them by 2^precision gives you the real value they represent.
 
@RMartinhoFernandes Hm.... looks strange. But anyway thanks. Possibly I'm missing something.
 
@user800454 Yes. And just in case you don't know the latest standard was published last year. VC++ already supports some of the new stuff.
@Alex If you make an example that reproduces the error it will be easier to find the cause. You may even find it yourself while making such an example.
 
@user800454 no clue. My gut feeling is that between arrays, vector and valarray, they'll probably be skeptical of adding another array-like data structure. But of course, you never know
 
#define DefaultConstructible typename
Ugh.
 
What's |r| mean in big O notation?
I assume absolute value, but r can't be negative to begin with
 
10:22 AM
Just like that, O(|r|)?
(Look, those look like bananas!)
 
Yeah, I can get the entire quote
 
user142019
Maybe r can be negative, but only for very large values of r.
 
"in time O(|r|), where |r| stands for the size of r - the sum
of the number of operators and operands in r."
 
What's JrJ?
 
user142019
10:23 AM
thats not a |, its an l.
 
I suspect bad OCR.
 
It's displayed as |r|, must be some wierd pdf conversion
 
user142019
k
 
@Pubby What is r? A number?
A set? Something else?
 
Let me check, I think it's a regex
 
10:25 AM
That "number of operators and operands in r" part makes me believe it's not a number.
 
r is a letter in the alphabet, it comes after q and before s
 
"Let us consider the cost of converting a regular expression r to an NFA"
 
lulz
ah, a regex
meh
 
@RMartinhoFernandes Well I moved the struct A declaration above the template specialization and it works now.... Seems to be really strange......
 
10:25 AM
better then a transform
lol
 
@Alex Ah! That makes sense! You need the declaration before to use it in the specialization.
@Pubby |r| is there defined as the size of r.
So, that's O(size of r).
Or O(number of operators in r + number of operands in r).
 
Yeah, guess that's it. Book keeps using strange notation everywhere, not that it matters
 
@RMartinhoFernandes Oh great..... Just now I realized as stupid it was.... Anyway, thanks.)
 
@RMartinhoFernandes do you have a link to the full published standard by any chance? Or where was it published I have access to all journals
 
@user800454 There are links on the C++11 wiki page
 
10:35 AM
0
Q: What am I doing wrong with this Arithmetic Parser?

IntermediateHackerHere is the code for a simple arithmetic expression parser I wrote: class ArithmeticExpressionParser<T> : Parser<T> where T : IConvertible { dynamic num1, num2; public override T Parse(string expr) { base.Parse(expr); ParseExpression(); return num1...

damn parsers...
 
@user800454 The latest public draft is avaible here. You can also build a PDF from the LaTeX sources on github.com/cplusplus/draft, or buy it from ISO for only CHF 238.
 
@IntermediateHacker factorial??
 
@IntermediateHacker Do you know that Code Review is for working code?
That's a Stack Overflow question.
 
@RMartinhoFernandes how do i move it to SO?
 
I flagged it. Now hope a mod, or enough people with close privileges swoop in.
 
10:41 AM
I have a nitpick, why the extra line between } and else?
 
lol, I flagged my own question.
hope some mod attends to it soon.
 
Where can I find an infinite number of positively charged particles?
 
sbi
@RMartinhoFernandes It's in the package. Just look at the instructions. (As always, you need to call them if the number is wrong.)
 
@RMartinhoFernandes next to a source of an infinite number of negatively charged particles
 
10:56 AM
why doesn't wikipedia just display advertisements to earn money?
 
From time to time they ask for donations, yes.
 
I know, but won't it be easier to just display ads? why don't they just stop asking for donations and display ads?
 
Nearly every "personal appeal" explains why they don't show ads
 
@IntermediateHacker because they don't think it's the same thing
 

« first day (445 days earlier)      last day (4495 days later) »