« first day (3137 days earlier)      last day (1795 days later) » 

5:12 AM
 
5:36 AM
Hey everyone, I'm following along a tutorial demonstrating how to use Direct2D and in the dude's video, everything works, but I've followed very closely, but he doesn't get a syntax error I'm getting
I'm getting a syntax error that looks like so:
error C2143: syntax error: missing ';' before '*' when declaring a pointer. The declaration looks like this: ID2D1HwndRenderTarget* renderTarget;
what am I doing wrong?
 
You could have made a mistake else where.
 
then why does the error say it's there?
that's basically the top of the file
#pragma once

#include <windows.h>
#include <d3d11.h>

class Renderer {
    ID2D1Factory* factory;
    ID2D1HwndRenderTarget* renderTarget;
public:
    Renderer();
    ~Renderer();

    bool Init(HWND WinHandler);

    void BeginDraw() {
        renderTarget->BeginDraw();
    };

    void EndDraw() {
        renderTarget->EndDraw();
    };

};
that's the whole thing
okay, I did something that made it work, what an embarrassment
okay, different question, what's wrong with this code?
res = factory->CreateHwndRenderTarget(
            D2D1::RenderTargetProperties(),
            D2D1::HwndRenderTargetProperties(WinHandler, D2D1::SizeU(WinSize.right, WinSize.bottom))
            &renderTarget);
i'm getting a buttload of errors
 
thanks
 
 
1 hour later…
7:23 AM
So, I tested TensorRT. The performance matches my theoretical calculation 1 to 1. If you can get this stuff out of the box, what am I going to do for a living :-)
 
nwp
7:52 AM
@JerryCoffin It's not that simple. Conversions from one type to another is not possible in C++. You can create a new object with a different type and a similar value, but nobody defines when the new value is similar enough, so that doesn't help in defining what a cast is.
There is no agreed upon definition when Type(arg) is a cast and when it isn't. "Value-preserving" is the most common one, but it is ill-defined.
 
8:42 AM
More legs for your chicken!
 
9:18 AM
@JacobSchneider What was it?
 
@fredoverflow what was what sorry?
 
4 hours ago, by Jacob Schneider
error C2143: syntax error: missing ';' before '*' when declaring a pointer. The declaration looks like this: ID2D1HwndRenderTarget* renderTarget;
4 hours ago, by Jacob Schneider
okay, I did something that made it work, what an embarrassment
@JacobSchneider What was the problem, and how did you fix it?
"Missing ;" was not the real problem, was it?
 
I have no idea
I'll be honest, I dunno
I did something
 
I remember that "missing ;" appears in C code when you mix variable declarations and other statements, but that should not apply to C++.
 
that's good to know
hey, sorry, unrelated question, I'm obviously very new to C++ and I've got a small problem: I've got a bunch of node.js bindings in entry.cpp and one of those bindings is supposed to set a value that I'll use in a function defined outside of entry.cpp, so I've created a store
but when I reference the header in entry.cpp and the file I want to use, I get a duplicate declaration error
how can I pass values to and fro files easily?
 
9:25 AM
You can't define a global variable in a header. You need to declare it in a header and then define it in an implementation file.
// store.h
extern int my_global_counter;

// store.cpp
int my_global_counter;
Of course, you would replace the type and the name with whatever is suitable in your case :)
 
@Rick Use a smart pointer. Then you don't need to manually delete. Arguably, manually new is also a mistake, but less of one as you can immediately place the result into a unique_ptr
 
Note the extern in the header file, that makes it a declaration instead of a definition.
 
@JacobSchneider bool init()? learn to constructors please
 
9:41 AM
@Puppy Yeah I am aware of basic OOP, I was simply following along a tutorial
 
10:11 AM
okeydokey
 
@fredoverflow Is it at all sensible to use a nested map?
 
10:43 AM
@fredoverflow how can I do that with structs, when I do that with structs I get weird errors
 
 
1 hour later…
11:44 AM
@JacobSchneider Impossible to help without seeing code.
 
Okay, gimme 2
this more or less explains what I want to do
 
Pretty sure extern typedef is illegal, you can't combine multiple storage classes. Also, no need for typedef struct in C++, anyway.
// store.h
struct Store {
    std::string name;
};

// store.cpp
Store::Store() : name("Jacob") {}
Wait, do you want Store to be a type or a variable?
Because Store.name looks like a variable access.
@JacobSchneider I would suggest naming the type Score and the variable score:
// store.h
struct Store {
    std::string name;
};

extern Store store;

// store.cpp
Store store = {"Jacob"};
And then access store.name inside the other files.
 
12:04 PM
okay, awesome!! thank you so much
 
 
3 hours later…
2:51 PM
@JacobSchneider ugh no globals plix
 
 
2 hours later…
4:31 PM
 
 
2 hours later…
6:26 PM
@nwp Of course there's an agreed-upon definition--the one in the standard. The only room for disagreement is what wording you use If you want to be pedantic, the standard uses the phrasing: "Explicit type conversion (functional notation)" (see §[expr.type.conf]). Note that although you're correct that this creates a new object of a specified type, the standard still uses the phrase "type conversion" to describe it.
 
 
1 hour later…
7:55 PM
is there a nice pattern for walking as you add to an iterator. This is the only thing that works that imitates that pattern. However, I find it lacking
 
nwp
That looks like it belongs here.
 
@nwp good point can you move it
 
nwp
Nope. Not powerful enough.
 
@nwp should I flag it
 
nwp
Just leave it.
 
8:13 PM
@nwp does the question make sense?
 

« first day (3137 days earlier)      last day (1795 days later) »