C++ on Stack Overflow and Game Dev

0 answers

condition_variable without mutex in a lock-free implementation

I have a lock-free single producer multiple consumer queue implemented using std::atomics in a way similar to Herb Sutters CPPCon2014 talk. Sometimes, the producer is too slow to feed all consumers, ...

2 answers

passing struct to a function c++ (efficiency)

I'm testing timings on a simple code and I don't see the difference. In first block it acts like only the pointer is passed, in case 2 and 3 it acts like copying it by value not by reference, the ...

1 answer

Changing the value of lParam in WndProc windows hook

I am trying to change the rectangle in which windows are minimized with a shell hook to HSHELL_GETMINRECT in my C# WPF application. Following this Win32 C API for redirecting minimize animation I ...

4 answers

Find all timings with given angle of clock minute and hour hands

Given absolute value of angle between hour and minute hands. We need to find all valid values of time (in hours and minutes, both non-negative integers) from midnight (inclusive) to noon (not ...

4 answers | 8 mins ago by GitCoder on Stack Overflow stackoverflow.com
0 answers

template SFINAE and enable_if to switch between dynamic and fixed size

I am new to SFINAE and i hope more advanced c++ template developers to be able to help me. I have a template that I would like to be able to accept classes that the size could be determined simply ...

0 answers

Multi-dimensional arrays and pointers in C++

Let's say I declare and initialize the following multi-dimensional array in C++: unsigned a[3][4] = { {12, 6, 3, 2}, {9, 13, 7, 0}, {7, 4, 8, 5} }; After which I execute this code: ...

0 answers

How to draw a bazier spline opencv

This is my code which when I run it, it shows a ready bazier spline which I can't edit on it #include "stdafx.h" #include <stdlib.h> #include <gl/glut.h> // 4 control points ...

1 answer

error: invalid conversion on const return type

Using g++ version 4.8.4 I get an error: error: invalid conversion from ‘const SSL_METHOD* ()() {aka const ssl_method_st ()()}’ to ‘MethodFuncPtr {aka ssl_method_st (*)()}’ [-fpermissive] I can ...

1 answers | 19 mins ago by Rob on Stack Overflow stackoverflow.com
1 answer

Can anyone explain the output of the following program?

#include <iostream.h> #include<conio.h> #define PRODUCT(x) (x*x) int main() { clrscr(); int i=3,j,k,l; j= PRODUCT(i+1); k= PRODUCT(i++); l= PRODUCT(++i); ...

1 answers | 19 mins ago by Pooja Singh on Stack Overflow stackoverflow.com
1 answer

Need to create a function for a casino game

I have a Project for my programming class, and its requiring me to set up the main functionality for the casino using functions. First, I needed to seed the random number generator which I think I ...

1 answers | 21 mins ago by ProjectAnsem on Stack Overflow stackoverflow.com
3 answers

Searching for a fast/efficient histogram algorithm (with pre-specified bins)

I don't do much coding outside of Matlab, but I have a need to export my Matlab code to another language, most likely C. My Matlab code includes a histogram function, histc(), that places my input ...

3 answers | 22 mins ago by ggkmath on Stack Overflow stackoverflow.com
0 answers

file uploading using base64 implementation

i want to upload file i use this code it is uploading text file successfully but while uploading .doc and other format file it is not uploading file successfully while opening the file it is showing ...

0 answers

Mingw64 not linking due to undefined references

I started to learn mingw64 and tried to compile this cpp file using netbeans 8.0.1 What I need to see is the dialog of printing of windows and to print the text "Hola mundo". #include <stdio.h> ...

6 answers

Understanding virtual destructors

I was trying to familiarize myself with the OOP concepts but could not quite understand the concept of virtual. One can create a virtual destructor but not a virtual constructor. Why? How are ...

6 answers | 34 mins ago by user1603970 on Stack Overflow stackoverflow.com
1 answer

How can I specify non-deducible template parameters on a constructor?

It's possible to give a templated constructor template parameters that cannot be deduced: struct X { int i; template<int N> X() : i(N) { } }; How would you use such a ...

1 answers | 36 mins ago by zneak on Stack Overflow stackoverflow.com
0 answers

C++ Phone Book Program Won't Stop Making New Contacts

I need some help on a Phone Book program I am trying to make with vectors: PhoneBook.cpp (main) // PhoneBook.cpp : Defines the entry point for the console application. // #include "stdafx.h" ...

0 answers

Initializing custom map class object causes error C2783

I recently implemented my own custom map class as std::map replacement for my C-runtime independent project. I know it might not be as efficient as std::map but it serves its purpose. This is how ...

1 answer

Fortran calls C++ pointer function

I have a problem with connecting Fortran program with C++ function. My task is to call C++ function pointer from fortran, example: // C++ function pointer double* GetSplinePtr() { return sp; } ...

1 answers | 43 mins ago by Gatto on Stack Overflow stackoverflow.com
1 answer

OpenGL blank screen?

I am learning OpenGL from book, I did exactly what is in the book, but when I run it (Eclipse C++ IDE) I get just blank screen. Book is "OpenGL guide for programmers". I think the error is in ...

1 answers | 45 mins ago by iUua on Stack Overflow stackoverflow.com
2 answers

What's the difference between a sentinel and an end iterator?

While reading Eric Niebler's range proposal, I've come across the term sentinel as replacement for the end iterator. I'm having a difficult time understanding the benefits of sentinel over an end ...

8 answers

What high-level approach should I use to improve performance when implementing long equations in C++?

I am developing some engineering simulations. This involves implementing some long equations such as this equation to calculate stress in a rubber like material: T = ( mu * ( pow(l1 * ...

1 answer

Store intime/outtime according to roll no.s in a file

I have been asked to write a program that asks the rollno from user to let the student go inside first and then keep that InTime fixed and only change the outTime by asking the rollno of the student ...

1 answers | 45 mins ago by Vibhu on Stack Overflow stackoverflow.com
3 answers

CMake : branch on clang version

How does one achieve the equivalent of the cmake branch below for clang++? if (GXX_VERSION VERSION_GREATER 4.5 OR GXX_VERSION VERSION_EQUAL 4.5) ... Thanks,

3 answers | 47 mins ago by Gurg Hackpof on Stack Overflow stackoverflow.com
2 answers

Understanding GLSL Uniform Buffer Block Alignment

I'm having trouble understanding the std140 layout for GLSL uniform buffer objects. I'm under the impression that in the following uniform block, the int will begin at offset 0 and the matrix will ...

2 answers | 48 mins ago by Ross Lombardi on Stack Overflow stackoverflow.com
2 answers

C++ Development Flow with 3rd Party Dependency

I'm a Python developer with some background in another language such as Ruby. In both language, dependency is managed by package manager automatically, such as pip or gem. Anyone could install such ...

2 answers | 50 mins ago by Yeo on Stack Overflow stackoverflow.com
0 answers

Best Practice for Iterators (file)

I currently working on a class where I want to work with auto-range loops (C++11). As far as I know I need to write an iterator-class to do this. Since I never wrote an iterator class before, I ...

0 answers

cppyy and genreflex namespace handling

I am trying to understand the inner workings and especially the namespace handling of cppyy and genreflex used in conjunction. For this, I'm following http://doc.pypy.org/en/latest/cppyy.html ...

2 answers

CryptoAPI RSA: CryptDecrypt decrypts only one time, after came NTE_BAD_DATA

I have write the programm which encrypts/decrypts memory buffer of custom length. Ecryption ends well; but my decryption code decrypts data only one time at any buffer position, wich corresponds to ...

2 answers | 1 hour ago by Mykola on Stack Overflow stackoverflow.com
0 answers

Trie implementation in c/c++

I am implementing multibit trie in C. When I run the code, I get run-time error: bus error (core dumped). I am getting this error when I am adding different nodes through calling insert_rule method. ...

0 answers

Disassembled function parameter (unsigned __int8)haystack[19] << 8)

I try to understand what IDA is trying to do with this line. I am learning decompilation. I make some progress by myself but i am stuck. I cannot figure this out at all. sub_1ED08(((unsigned ...

15 30 50 per page
1 2 3