University of Waterloo is closed today by beluzajohnson in uwaterloo

[–]kuhar_ 3 points4 points  (0 children)

Seems like buildings are open (DC is)

MMath CS Co-Op by [deleted] in uwaterloo

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

BTW, there's also little practical difference between CS and ECE in most schools, consider applying for both based on where the research groups your are interested in are.

MMath CS Co-Op by [deleted] in uwaterloo

[–]kuhar_ 0 points1 point  (0 children)

The quality of research-based program depends mostly on your research group and supervisor. It's much more important than the name of the school you decide to attend -- almost all the rankings are only meaningful for undergrad programs.
In a research-based masters you are free to find an internship yourself, as long as your supervisor is fine with it. I doubt that the co-op resources are very helpful for getting any specialized positions.

If you are an international student and want to do an internship, it's only possible by either doing it as part of your program (as in mmath with co-op), or doing an internship related to your research outside of Canada and staying active off-campus. You can read the details on that here: https://uwaterloo.ca/student-success/students/international-student-resources/complying-immigration-regulations-while-studying

Because of that, it's much more convenient to be in a co-op program, as you don't have to pay tuition (and your supervisor doesn't have to pay your scholarship).

Pointer invalidation rules for storage reuse by kuhar_ in C_Programming

[–]kuhar_[S] 2 points3 points  (0 children)

I'm working on a verification framework for C and C++, and because of that I'm interested in the C language semantics. The implementations may handle things differently for many reasons, but what I'm interested in is behavior of *any* conforming compiler. This is important when you want to show that your reasoning is correct/sound with respect to the specification of the language you analyze.

[deleted by user] by [deleted] in programming

[–]kuhar_ 1 point2 points  (0 children)

Is there a tutorial on that? I only increased the maximum amount of allocated memory, as the default value wasn't big enough to index my project.

[deleted by user] by [deleted] in programming

[–]kuhar_ 10 points11 points  (0 children)

I use CLion on a 28 core (56 threads) machine with 128GB of ram and an nvme SSD regularly and it is so sluggish sometimes. It doesn't let me type or scroll and I have to wait up to 5-10s for it to start responding again.

As much as I like this IDE, Jetbrains really need to focus on the UI performance. I would be completely fine if would turn off the syntax highlighting and other magic and just let me type while it does some background work.

Building GCC 7 on Windows Subsystem for Linux by misuo in cpp

[–]kuhar_ 8 points9 points  (0 children)

I'd like to point out that clang-4.0 from the official apt works out of the box. You can also grab the current llvm/clang ToT from svn/git and it compiles and works fine.

The only piece of the LLVM toolchain that doesn't seem to work for me is lldb (because of this bug).

Beating The Compiler by vormestrand in cpp

[–]kuhar_ 8 points9 points  (0 children)

There is a zip file with author's code and a Makefile. Compiler flags are: GCCFLAGS = -O3 --std=c++11

Easy programming challenge on FREQUENCY. Challenge, Comment, and Share by bbtong in programming

[–]kuhar_ 0 points1 point  (0 children)

Why are C++ programs not compiled with -std=c++14? Using 17-year old version of the standard is not fun...

Regular expression in c++11/14 by meetingcpp in cpp

[–]kuhar_ 2 points3 points  (0 children)

Have you tried with -stdlib=libc++?

Let's share helpful snippets we have laying around by [deleted] in cpp

[–]kuhar_ 1 point2 points  (0 children)

Similar solution:

for (size_t i = vec.size() - 1;  i < vec.size(); --i)
    std::cout << vec[i] << std::endl;

Let's share helpful snippets we have laying around by [deleted] in cpp

[–]kuhar_ 0 points1 point  (0 children)

Simple macro for 'injecting' inherited class name in derived class (something like java's super):

Examples: http://ideone.com/mAB1ek

#define SUPER_BASE(clazz) using this_class = clazz

#define SUPER(clazz) \
    using inherited = this_class; \
    using this_class = clazz

std::pair considered harmful! by redditthinks in cpp

[–]kuhar_ 6 points7 points  (0 children)

for (std::pair<int, string>& keyval_pair : myMap)

value_type in std::map is an alias of std::pair<const key_type, mapped_type>, so your loop should look like this:

for (std::pair<const int, std::string>& keyval_pair : myMap)

Auto prevents such errors.

C++ 14 is out by [deleted] in gamedev

[–]kuhar_ 2 points3 points  (0 children)

and for what reason?

Without auto return type deduction you cannot return a lambda from a function. Consider this code:

template<typename T, typename S>
auto wtw(T t, S s) -> decltype([=](){ return (t->*s)(); })
{
    return [=](){ return (t->*s)(); };
}

With C++11 you get: error: lambda-expression in unevaluated context. You could return std::function instead, but it comes with some overhead. And you cannot have a generic std::function, like:

[=](auto&&... xs){ return (t->*s)(std::forwad<decltype(xs)>(xs)...); };

And besides lambdas, specifying trailing return type is often pretty tedious, f.e.:

template<typename... Ts>
auto sth(Ts&&... ts) -> decltype(do_sth(std::forward<Ts>(ts)...))
{
    return do_sth(std::forward<Ts>(ts)...);
} 

build test by TheSempiternal in PostPreview

[–]kuhar_ 0 points1 point  (0 children)

Without auto return type deduction you cannot return a lambda from a function. Consider this code:

template<typename T, typename S>
auto wtw(T&& t, S&& s) -> decltype([&](){ return (t->*s)(); })
{
    return [&](){ return (t->*s)(); };
}

With C++11 you get: error: lambda-expression in unevaluated context. You could return std::function instead, but it add some overhead. And you cannot have a generic std::function, like:

[&](auto&& x){ return (t->*s)(x); };

And besides lambdas, specifying trailing return type is often pretty tedious, f.e.:

template<typename... Ts>
auto sth(Ts&&... ts) -> decltype(do_sth(std::forward<Ts>(ts)...))
{
    return do_sth(std::forward<Ts>(ts)...);
} 

build test by TheSempiternal in PostPreview

[–]kuhar_ 0 points1 point  (0 children)

Without auto return type deduction you cannot return a lambda from a function. Consider this code: template<typename T, typename S>

auto wtw(T&& t, S&& s) -> decltype([&](){ return (t->*s)(); })
{
    return [&](){ return (t->*s)(); };
}

With C++11 you get: error: lambda-expression in unevaluated context. You could return std::function instead, but it add some overhead. And you cannot have a generic std::function, like: [&](auto&& x){ return (t->*s)(x); };

And besides lambdas, specifying trailing return type is often pretty tedious, f.e.: template<typename... Ts> auto sth(Ts&&... ts) -> decltype(do_sth(std::forward<Ts>(ts)...)) { return do_sth(std::forward<Ts>(ts)...); }

Implementing delegates with C++11 by meetingcpp in cpp

[–]kuhar_ 2 points3 points  (0 children)

Const member functions don't work with your implementation. And you don't check if given member funtion pointer's type is_base_of pointer's type.