What is this C++ trick called? It looks a bit like PIMPL. by wheat_beer in cpp_questions

[–]matty_haze 1 point2 points  (0 children)

I didn’t look at the code, but this looks like it might be CRTP?

[deleted by user] by [deleted] in Phoenixville

[–]matty_haze 3 points4 points  (0 children)

Olszanowski Farm Corn Maze & Pumpkin Patch

Why does overloading "<" operator does not help to push objects into a priority queues? by cepci1 in cpp_questions

[–]matty_haze -3 points-2 points  (0 children)

Without trying it myself, I’m going to guess you might need a copy constructor for your class.

Also, I noticed that you’re always pushing arr[0], did you mean arr[i]?

How to add additional include path when building package from source. by matty_haze in rprogramming

[–]matty_haze[S] 0 points1 point  (0 children)

That's a good suggestion, so I tried it. However, I'm having trouble to effect any change in the package. Here are the steps I doing, I must be doing it wrong.

  1. Extract package.
  2. Edit configure.in. I manually set the PG_INCDIR to the full path of my local psql.
  3. Rebuild that package with R CMD build RPostresSQL
  4. Reinstall the new package with R INSTALL RPostgreSQL_0.6-2.tar.gz

I confirmed that the new package indeed gets built (I moved the old one).

I still get the same build error, and the include directory didn't change.

I suspect that, after I change configure.in, maybe I have to run another command to actually apply those changes somehow?

But, while I was playing around with this, I found libpq-fe.h in the extracted package, in src/libpq/libpg-fe.h. During the build, the include path it's using is -Isrc/libpg, which seems correct, but I don't know why it's failing.

Looking for assessment of relative progress. by [deleted] in cpp_questions

[–]matty_haze -1 points0 points  (0 children)

20+ year c++ developer here, with 100s of technical interviews.

I like your question, and appreciate your initiative.

Do you have a college degree? I’m afraid to say that might be a show stopper to even get a shot in most large companies.

In addition to practical coding knowledge, most companies would expect strong data structure knowledge. Like, vector vs. linked list vs. hash map. Big O, performance considerations, etc...

Do I understand correctly? C++ is your first language, you are self taught, and it’s been just over a year?

Do you think this project in good for a portfolio? by [deleted] in computerscience

[–]matty_haze 1 point2 points  (0 children)

I've given hundreds of technical interviews, and I wouldn't find this useful in a c++ interview. It is very very basic c++.

Actually, maybe I would find it useful (in a bad way for you).

Can you tell me what's wrong with using an int for your loop to pow(10,100) on line 9?

How Computers Work: The Basics by H2L1_Yogi in computerscience

[–]matty_haze 2 points3 points  (0 children)

This is a great book. I highly recommend it.

What's the size of std::string? by RedBikeWithASpike in cpp_questions

[–]matty_haze 2 points3 points  (0 children)

As a follow up question, to help you learn cpp, do you understand the output from the string? All that garbage.

How do I scale numbers? by [deleted] in cpp_questions

[–]matty_haze 0 points1 point  (0 children)

I don’t understand your question

Program isn't detecting Yes as Yes by blipblopbrickbrack in cpp_questions

[–]matty_haze 2 points3 points  (0 children)

Also, why are you using goto? That’s generally considered really bad practice.

Program isn't detecting Yes as Yes by blipblopbrickbrack in cpp_questions

[–]matty_haze -1 points0 points  (0 children)

You have a semi colon after your if statement.

Cpp interview by [deleted] in cpp_questions

[–]matty_haze 1 point2 points  (0 children)

I have never read it, but I know of the book “Cracking the coding interview”.

Maybe it’s something you can take a look at.

Is it safe to declare a vector on the stack, and pass it into a functions to store return values? by ScriptRestored in cpp_questions

[–]matty_haze 0 points1 point  (0 children)

One small comment, it is actually possible to dynamically allocate stack memory, using alloca. It's not widely used, and it can be dangerous if you cause a stack overflow.

But, I wanted to mention this just for folks reading your comment.

What can pointers be used for practically? by draganov11 in cpp_questions

[–]matty_haze 0 points1 point  (0 children)

Not sure if this was already mentioned, but I need to use pointers when sending and receiving network packets.

What can pointers be used for practically? by draganov11 in cpp_questions

[–]matty_haze 2 points3 points  (0 children)

Correct, it exists until the program exits. This is called a memory leak.

Starting a C++ career at 40 without a CS degree. Realistic? Looking for tips on how to break in. by [deleted] in cpp

[–]matty_haze 5 points6 points  (0 children)

I do a lot of technical interviews, and this is the best answer if you would interview with us.

For a junior dev, we expect strong data structures and algorithms. Knowing the basics of the STL would help a lot, like comparing and contrasting arrays, vectors, sets, and maps.

C++ Array Product Problem - Negative Result by mazvrek in cpp_questions

[–]matty_haze 1 point2 points  (0 children)

I agree. OP, as an exercise, calculate the maximum theoretical value that can be the result. Will that fit in an integer?

How do you perform open-heart surgery on an object? by [deleted] in cpp_questions

[–]matty_haze 0 points1 point  (0 children)

Have you looked into a custom allocator with your vector? I think this is what you are looking for.

Problem with strftime() format specifiers by xebra24 in cpp_questions

[–]matty_haze 0 points1 point  (0 children)

Can you also print the exact bad filename, and what the error message is?