« first day (735 days earlier)      last day (4229 days later) » 

4:00 PM
@bamboon This is Token. paste.ubuntu.com/1292564 btw I guess I forgot to initialize the vector.
 
but position is float3 in the layout, and float4 in the shader
don't see how that would work right if you use D3D11_ALIGNED_APPEND
 
@rogcg wait, your Token is a template
 
SV_Position only allows for float4 when declaring the shader, but my vertex data stream is float3. It seems to do the conversion automatically (the position is always correct when it shows up on the screen), the only two things which seem to strangle each other are the texcoord and color
 
@rogcg you need to specialize which Token you want to store in your vector
 
@rogcg Token is a class template, as such std::vector<Token> is invalid, much like std::vector<std::vector> would be. Something like std::vector<std::vector<int> > is valid however.
 
4:01 PM
I'll try making a Vector4, Vector4, Vector2 stream in RAM though and send it over
see what happens
 
@ThePhD SV_Position is for when you return form the vertex shader
for vertex input you can use just Position
struct VS_IN
{
float3 pos : POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD;
};
 
but I think you are using the template parameter a bit wrong, if it's just for the == operator
 
@melak47 Alright. I'll give that a shot.
 
@bamboon how?
 
@rogcg you can just make that operator a template
 
4:04 PM
how ? BTW I'm a newbie. sorry for noob questions
 
as you would do with any other function
 
NVM.
For the operator, I'm guessing you want something like template<class T> bool operator==(T obj);
 
@melak47 Changing the declaration to use Float4 in memory throughout (except for the texture coordinate) and matching it exactly with the shader's input layout (float4, float4, float2), the color still comes out as completely black, despite being set to blue (0, 0, 1, 1)
 
@KendallFrey great!
 
@ThePhD can I see your static vertex array?
 
4:13 PM
@melak47 Here it is
BAM I got it right on the first try. So good at this.
 
the link? :D
 
Yeah
 
does the color still end up in tex?
 
In the shader, looks like it. When I draw using return float4(tex, 0, 1) from the shader, it outputs whatever's in x and y of what's supposed to be in the color attribute. Black in this case, because I can't access tex.z and get the blue that's apparently in there.
 
#include <iostream>
void analyze() throw (std::ios_base::failure);

error: 'std::ios_base::ios_base(const std::ios_base&)' is private|

why?
 
4:15 PM
If I change the color to red, tex.x suddenly becomes 1.0
 
@ThePhD well, put something in the red channel and see if it comes out
...heh
that is err, unusual....
 
Yeah. I'm not sure what to do.
Tbh, I kinda give u-
Wait... WAIT. WAIT A SECOND.
... Aha... ahahahahahahahahaha
 
forgot to recompile the shader?
 
ahahahahahashahahahahahhhhhhhhhhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa‌​aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa‌​aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Fixed the problem.
No, it's
just that DirectX doesn't do the mapping that apparently I thought it does.
 
...meaning what
 
4:19 PM
The Vertex Shader was still passing out its float4 position in the first slot, despite the Pixel Shader not having the matching signature and only asking for 2 components.

void QuadVertex ( inout float4 position : SV_Position,
inout float4 color : COLOR0,
inout float2 tex : TEXCOORD0 ) {

position = mul(position, ViewProjection);
}

float4 QuadPixel ( float4 pos : SV_Position,
float4 color : COLOR0,
float2 tex : TEXCOORD0 ) : SV_Target0 {

return color;
}
Changing it to the above lined everything up. The reason Tex was in Color's spot is because I didn't have the float4 pos in the QuadPixel declaration
 
yeah it doesn't really map by semantic or anything there
 
I thought the Semantics were supposed to map things over for you.
But I guess not. Ughgughgughgughgughghhhhh how sad.
 
semantics are supposed to screw you over :3
 
Why even give me semantics if you're not going to line things up? Don't be mean like that, DirectX. D:
Ugh. God dangit.
What a time sink. Now I have to rewrite all my shaders to match perfectly.
And I can't do the mix-matching I was planning on doing.
There's gotta be a reason why it doesn't just line it up... I'm gonna find out.
... After I eat something.
 
clang y u segfault.
 
4:23 PM
@ThePhD just define a couple common return type structs and use them with all shaders.
 
4:33 PM
Gotta write a parser from scratch for an assignment, and I have absolutely no idea where to start from. Neat.
 
start with strings :D
 
Hahaha, saw that coming.
 
Trying to initialize an object

LexicalAnalyzer lexicalAnalyzer = new LexicalAnalyzer(indata);

and get this error.

`conversion from 'LexicalAnalyzer*' to non-scalar type 'LexicalAnalyzer' requested`
any idea?
 
yes
 
indata is a ifstream object
 
4:43 PM
you need LexicalAnalyzer*
but besides that, you probably don't need pointers at all
 
my object should be a pointer?
 
new is for pointers yes
 
You're trying to dynamically allocate an object of type LexicalAnalyzer
 
@rogcg Do you want a reference type or a value type?
 
don't want to sound harsh, but you should probably read book
 
4:44 PM
value type
 
The result of the construction will be of type LexicalAnalyzer*
 
Then skip the new.
 
like Accelerated C++ or C++ Primer
 
LexicalAnalyzer lexicalAnalyzer = LexicalAnalyzer(indata);
 
@bamboon i'm following a book already. I'm testing some code
I still have this

initializing argument 1 of 'LexicalAnalyzer::LexicalAnalyzer(std::fstream)'|
I dont get what this is
 
4:47 PM
More succinct: LexicalAnalyzer lexicalAnalyzer(indata);
@rogcg That error is incomplete.
 
what??
 
you can't copy streams
 
There should be more to it.
 
you mean I cant initialize that object..
what is the approach in this situation then?
should I do it by reference or what
 
What does your constructor declaration look like and what's your intent?
 
4:51 PM
@LucDanton my constructor is just initializing the variable declared in .h file
I just want to intialize it
 
That's not an answer to my question.
Post code. Just the declaration.
 
ok
 constructor

    LexicalAnalyzer::LexicalAnalyzer(std::ifstream input)
    {
        // ctor
        this->indata = input;
    }
indata variable is declared in LexicalAnalyzer.h
 
It would be customary to indeed declare the constructor as LexicalAnalyzer(std::ifstream& input);. In fact, you'd take std::istream&.
However you'll next run into the question of: what should indata be?
 
a text file
 
I meant type-wise.
 
4:54 PM
here is how I create indata in main function

 std::ifstream indata;

    // Reads the source .px file
    indata.open("prog1.px");
 
Right. Even if you do declare the constructor parameter to be a reference, you'll hit the same problem: you can't copy an std::ifstream.
 
@LucDanton what is ur advise then?
 
Are you using C++11 or C++03?
 
@LucDanton I guess its not c++ 11
 
CodeBlocks is not a compiler, but that's not important right now. I'm going to assume C++03.
 
5:00 PM
iirc C::B uses mingw, has it been updated to C++11? I doubt so
on windows anyway
 
One option is to decide that the class will not 'own' the (file)stream, and that it will instead only refer to it. This kind of relationship between classes is called an association.
By contrast when a class 'own' another type (such that an instance of that class contains a subobject of that type) it's called composition.
 
yeah..
 
If you settle on association then all that the class cares about is that 'there is a stream somewhere, and I'm going to use it for my purposes'. Typically you'd write the constructor as explicit LexicalAnalyzer(std::istream& input);, and you would use std::istream* indata; as a member.
 
@LucDanton got it
 
@LucDanton Did you mean std::istream&?
 
5:04 PM
It's a bit inconvenient to always have to do e.g. *indata >> foo when needing to use the stream but as inconvenience goes having std::istream& indata; as a member is worse.
 
Care to elaborate a bit on why it's worse?
 
No.
 
Okay then.
 
Go read books or something.
 
Geez, touchy.
 
5:10 PM
 
Hey, you're not new. I can say 'no' to any of your requests. Deal with it!
 
Doesn't even answer the question, but there are so many problems with it otherwise.
 
@chris Downvoted for use of malloc to answer a c++ question
not to mention everything else that is wrong with it
 
@Borgleader, Good point, I didn't even mention the malloc.
 
I did :)
 
5:13 PM
@LucDanton I did, didn't I?
Or doesn't "Okay then." count as dealing with it nowadays?
 
How much RAM is on that motherboard?
 
64 GBs
 
Yeah, just snooped around the conversation around it.
I thought my 12GB laptop was excessive. I would've settled for 6 gladly.
 
5:38 PM
I don't think he needs the 64GB for browsing the web :p
 
  total       used       free
8177952     877764    7300188
I guess I don't really need 8 GB in my system, 1 GB would have sufficed :)
 
this keeps complaingin that indata hasnt been initialized

std::ifstream& indata;
std::string filename = "file_name";

// Reads the source .px file
indata.open(filename.c_str());

declared as a reference but not initialized
 
which is entirely accurate, since it hasn't
 
Sure you need a reference?
 
yes
IDK how to initialize this thing.. I thought it didnt need, since I want to open that file
 
5:47 PM
Don't use a reference.
 
use what instead
 
Kill the ampersand and that example works.
 
std::ifstream indata("filename");
 
An instance, obviously.
 
@rogcg: How new are you to C++?
 
5:49 PM
and how do I send the stream to another constructor.. In a previous discussion with @LucDanton he advised me do this. using a reference
@Borgleader new
 
LexicalAnalyzer analyzer(indata);
 
-1
A: How to create a folder in Visual Studio C++ 2012

Hans PassantThe IDE has a command for that, "New Folder". It is even present in the Project + Add context menu, something you can see when you look at the context menu with Tools + Customize. It is however hidden in the C++ IDE. Intentionally. Its important to understand why it is hidden. It keeps you o...

 
@rogcg Do you need indata after the scope it is in?
 
^ Fun to downvote Hans Passant.
 
5:51 PM
LOL
@LucDanton this aproach seems not to declare my object. it keeps saying analyzer hasnt been declared in this scope.
 
@rogcg Can you show the code?
 
:5872042
LexicalAnalyzer lexicalAnalyzer(indata);
lexicalAnalyzer.analyze();
here is the constructor

    LexicalAnalyzer::LexicalAnalyzer(std::ifstream& input)
    {
        // ctor
        this->indata* = &input;
    }
 
Where does the error point to?
 
when I try do do this

if(lexicaAnalyzer.hasError())
    {
        lexicaAnalyzer.showErrors();
        exit(1);
    }
the erros points to the if, hasError()
 
@Cheersandhth.-Alf Why would you do that? It's perfectly accurate.
 
5:59 PM
Should be lexicalAnalyzer perhaps?
 
this->indata* = &input;?
 
WTF is this->indata*?
 
@LucDanton yeah in My case its lexicalAnalyzer, I was just following your text. But its correct here
 
that's not even valid syntax and it certainly doesn't make sense
 
@rogcg No I mean inside the if condition. The code you posted contains lexicaAnalyzer. Missing an 'l'.
 
6:01 PM
@DeadMG, It could be valid if it supports operator*= with whatever type &input is.
 
thats not the point
wait..
 
That's why we need actual code and actual errors rather than you telling us about it. Plus it's easier to copy-paste anyway.
7
 
Wait nvm, you can't have a space there.
 
@chris It would tokenize wrong.
 
@askmish Take a look at my edit.
 
 
1 hour later…
Ell
7:07 PM
wow
 
@Ell Surprised that the C++ chat managed to get a full hour of silence?
 
Ell
yes :L
 
@DeadMG it doesn't help with the question. it indicates functionality is present, that isn't actually present. so it's also very inaccurate.
 
I'm surprised at how few people there are here for this time of day o.o
 
@DeadMG Oh I tried out your comment, it works! Thanks.
however, i haven't tried with my usual project setup, where the source folders are not in the ide project folder...
 
Xeo
7:18 PM
0
Q: What the strange "mutable" lambda function in C++?

Alexander KaraberovI only begin to hardly use C++ lambda functions. And have some questions: While experimenting with lambdas I wrote such code and it compiles: auto func = [](string &str)mutable {return boost::algorithm::to_upper_copy(str);}; The question is what does mutable keyword in this context mean?...

close votes
 
I cant close vote T_T
 
foo::template bar<int>::template qux<int>
^ first template qualifier isn't needed, right?
 
It is.
 
@LucDanton Is the first template even allowed in C++03?
 
Mmh. I need to double-check.
 
Xeo
7:23 PM
@LucDanton Shouldn't that be similar to typename, since :: can only be applied to a scope?
No wait, nvm
typename tells up-front that the thing as a whole yields a type
 
Ideone broke, what's that other C++ testing site?
 
liveworkspace.org
 
1 year in university does wonders, I have absolutely no idea what is going on here. Perfect.
Back to books again I guess.
 
@Xeo No, you're right. :: makes sure that what appears before it is a type. typename always applies to the last id-thingy.
@Pubby Okay I'm reasonably sure that it is needed. Not that I'm really confident in these matters.
@Pubby I don't think there's any difference between C++03 and C++11 here.
 
@KhaledNassar You mean like you unlearned stuff because of university?
 
Xeo
7:28 PM
@LucDanton Wait, doesn't that directly contradict your last message?
 
@LucDanton I tested it codepad.org/RJxGR5x0
 
Mmh a non-normative note suggests that template is fine even when not needed (i.e. non-dependent contexts), just like typename. Which I recall is a C++11 feature, or perhaps just a clarification.
 
typename foo::template bar<T>::template qux<T> -- works
typename foo::bar<T>::template qux<T>-- works
 
@NikiC Yep, I was enrolled into the very underwhelming entry-level CS courses. Imagine having to put up with two semesters of a professor going on about how int x; shouldn't be used.
 
Xeo
@Pubby The typename shouldn't be needed, should it?
 
7:29 PM
typename foo::bar<int>::qux<int> -- works
 
Add to that a lot of assignments to keep you busy at all times and you have a recipe for disaster.
 
@Xeo Compiler says otherwise
 
@Pubby Oh I see. foo would need to be dependent for the first template to be necessary.
 
@KhaledNassar I'm assuming you're referring to the fact that x isn't being assigned in that statement?
 
Xeo
huh. a template already tells the compiler that you get a type, doesn't it?
 
7:31 PM
@LucDanton You mean like typename foo<T>::template bar<T>::template qux<T> ?
 
I thought if you were asking that template could be 'folded' the way typename can be, i.e. even in the case that foo is dependent then typename foo::bar::baz only needs one typename even though two dependent id-thingies are involved.
 
@Borgleader Yes
 
@Xeo No. Can be a member function template.
 
Xeo
hm.
 
For real!
 
7:33 PM
For some reason I can write template code and add in typename and template properly but if you asked me to formulate the rules for doing so I wouldn't know.
 
If it's dependent, it needs disambiguation. For types, only one disambiguation needed for the final id-thingy. For templates, each time.
 
@KhaledNassar Uhhh, now you got me scared
 
That's my own rule of thumb. No idea how accurate it is.
 
Sounds right
I wish templates and types had their own special tokens
 
@NikiC Can't tell how it'll be like for you. My main problem is my university's silly policy, basically you're not even allowed to provide whatever proof be it formal or informal to skip the basic stuff.
Or even sit for a test.
 
Ell
7:38 PM
hmm. I wonder if I have the balls to wear a mankini to a halloween party
 
@Ell Hah, that does take balls.
 
Man.
I cannot wait till tomorrow.
 
stackoverflow.com/a/5138926/99966 Even with the commend, I am a bit confused, what is the disadvantage of using isa?
comment*
 
Xeo
Jul 30 at 22:02, by Xeo
http://liveworkspace.org/code/74aff701737623e970a49d556512ca26
I remember having this discussion before with the robot :/
 
@daknøk What will be tomorrow?
 
Xeo
7:41 PM
Except at that time I was the one who had to convince him that it's needed
 
@NikiC concert with my three favorite bands and four other bands.
 
@Xeo ?
 
Xeo
@LucDanton Oh, read from there, that's what I meant
 
@Ell I disagree
 
Ell
7:46 PM
I love that kind of humor :L
 
probably because I didn't get it but wtv
 
What's there not to get?
Pretty.. straightforward
 
Well... I figure I must have missed something if I didn't find it funny
 
Nah. It just isn't funny. (Sorry Ell)
 
Ell
Haha it's okay, everyone has a different sense of humor
 
7:56 PM
@MartinJames: "To filter out recipients who are literate. They don't want to waste time on those with intelligence, education and experience. Ideally, the phishers only want replies from SQL/PHP developers." LOL I could not stop laughing when I read that this morning lol
 
mmmm ice cream sandwich, hey people
 
Tasty tasty gif
 
Ah, finally learned how to do TF2 online trading....
so nice...
 
there's a disturbance in the force, a newbie has appeared with newbie questions
 
7:58 PM
@Mysticial You traded a hat for another hat?
 
@Borgleader Nah, I just for 1-for-1 weapons of my dupes for things that I don't have.
 
can anyone tell me, what this line is doing exactly?

*index++ = i;

Specifically the ++ part
 

« first day (735 days earlier)      last day (4229 days later) »