« first day (486 days earlier)      last day (2371 days later) » 

10:08 AM
hello, i need to see if the machine im running my code has a 64 bit processor or a 32 bit processor, i ve seen a friend of mine do a #DEFINE in the begining of the program but i forgot what he typed and im not sure it that is the best way to achieve my goal, how should i detect if the processor is 64 bit or 32?
 
@jeyejow You can't - portably at compiletime. You should be able to detect the target architecture (which is not necessarily the architecture that the compiler runs on) using implementation-defined macros:
98
Q: Determining 32 vs 64 bit in C++

Joe CorkeryI'm looking for a way to reliably determine whether C++ code is being compiled in 32 vs 64 bit. We've come up with what we think is a reasonable solution using macros, but was curious to know if people could think of cases where this might fail or if there is a better way to do this. Please note ...

 
@sehe ok ill check that out, i was trying to get it by using the GetSystemInfo(&siSysInfo); function (on Windows), but it didnt return what i wanted, thanks!
 
CHAR_BITS * sizeof(void*)
that will tell you how many bits there are in a pointer
 
@ratchetfreak what is the return type of that? CHAR_BITS? if so, can i stoi() it?
i mean
not stoi but somthing like that
 
I'm sure you have access to google.
 
10:17 AM
CHAR_BIT is a define in #include <climits>
it is the amount of bits in a byte
 
as an integral number
 
@sehe @ratchetfreak ok, ill try that, thanks both!
 
11:17 AM
Hey people
 
11:53 AM
hello guys
I'm using boost Program options
and I wonder how I can specify a notifier using multitoken
something like this
("double",value<double>()->notifier(handleDoubleOption), "mydouble 1")
but If wanted to provide a vector I should do something like
 
Any of you good with ubuntu and cmake/make ? stackoverflow.com/questions/47200632/…
 
("vector",value<std::vector<double> >()->multitoken(), "Vector")
but I can't specify a notifier in that way
by the way the notifier for the double is simply like
`void handleDoubleOption(const double& val) {
std::cout << "Inserted double : " << val << std::endl;
}`
I'd like to specify a notifier for the vector as well, any suggestion?
in case it matters you can assume I use a fairly recent c++ standard, 11 or 14
 
@Thijser Have you used CMake before?
 
@VermillionAzure a few times but never in any detail
 
@Thijser Did you use CMake or make for that?
 
11:59 AM
I tried both
 
Are you sure you're building for C++ and not C?
and what compiler?
 
gcc4.9 + nvcc
I think it's c++ as boost is a dependancy
 
@Thijser what is common.hpp
Becuase it appears you're importing the C and not C++ version of the header, it seems
You should be importing, say <cstring> over <string.h> if you want the C functions to show up in the std namesapce
 
#ifndef CAFFE_COMMON_HPP_
#define CAFFE_COMMON_HPP_

#include <boost/shared_ptr.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>

#include <climits>
#include <cmath>
#include <fstream> // NOLINT(readability/streams)
#include <iostream> // NOLINT(readability/streams)
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <utility> // pair
#include <vector>

#include "caffe/util/device_alternate.hpp"

// Convert macro to string
#define STRINGIFY(m) #m
#define AS_STRING(m) STRINGIFY(m)
However I know that the code itself should be fine as it does seem to compile on other people's machines
 
12:53 PM
15 messages moved from Lounge<C++>
 
 
2 hours later…
2:26 PM
I'm using thrust (cuda) and I'd like to write to the source iterator of a permutation iterator but permutation iterators are not modifiable. Suggestions?
 
3:07 PM
Don't do that.
 
 
2 hours later…
5:19 PM
I want a method that reconstructs the eight vertices of an box. In this case i have to return an fixed container. Is it a good approach to return maybe a std::array<QVector3D,8> ?
 
6:00 PM
i have a problem where i am trying to query a server, i get data back but it appears as garbage i can query other servers directly but this query is to a master server i will post a link to the page and the code i am receiving, i am hoping someone can explain what i am doing wrong
the response i am getting (i will only post a small but as its too much for here
f
╣g`\iç╣g`[iç╣g`Ziç╣g`Tiç\▒╬içMKz╬jOR`ÊiçR`ÊiëR`ÊiêR`ÊiïMKz╬jÐMKz╬j█MKz╬iÎMKz╬jÃMKz╬i»MKz╬jcMKz╬jwMKz╬j;MKz╬j
╣%Ïìiç╣%ÏÅiç\▒╬iï\▒╬ië\ ðoiçWQÂKiçQì­hiçWQÂKièM_$×içM_$×iêM_$×iëM_$×ièM_$×iïM_$×iöM_$×iòM_$×iùM_$×i×M_$×iÜM_$×iøM_$×iØ
it should be a bunch of ip addresses, i am using boost and can also post my code if needed
 
Mojibake (文字化け) (IPA: [mod͡ʑibake]; lit. "character transformation"), from the Japanese 文字 (moji) "character" + 化け (bake, pronounced "bah-keh") "transform", is the garbled text that is the result of text being decoded using an unintended character encoding. The result is a systematic replacement of symbols with completely unrelated ones, often from a different writing system. This display may include the generic replacement character � in places where the binary representation is considered invalid. A replacement can also involve multiple consecutive symbols, as viewed in one encoding, when the...
 
yes i had thought something like this was happening but have no idea how to fix as am v new to c++
 
@Ambush actually they are sending you binary as a response
not characters
 
yes and i am using cout << hex but nothing works
and also iteratign through the array its stored in to try and print out the data but also no luck
hang on i will search for c++ binary conversion to see if that yeilds anything i can use
 
@Ambush have you examined it under a hex editor?
 
6:08 PM
well i am outputting to hex if that is what you mean, but am unsure how to do that in a hex editor as its just stored in a char array
 
@Ambush I'm saying to use a debugger (VC++ has one) and examine the buffer using the memory debugging tool
you should see the bytes as described in the response section
 
ok i will give that a go i am using vs2017
damn i never knew that i could do that
 
there seriously needs to be a "How to debug" course in Uni
it would save about 20,000 questions on SO that could have been answered if they knew how
 
I agree
80% of people who had asked me questions were surprised that the debugger can do X
 
the response part was confusing me as i couldn't understand where he was getting it from
 
6:14 PM
tbf certain debugging operations are OS specific, but at least knowing the basics of debugging in an IDE or gdb or windbg would be awesome
 
cant argue with that, i just know the very basics of things in vs unfortunatly tbh
 
side note: be careful of assuming genders on the internet
 
tnx for that, i dont appear to have any debuggers in my pc for 8.1 or 10.0etc
willl try and download them]
 
If you have visual studio, it has a debugger in it. You can get an external debugger (windbg probably) if you want, but you don't need to.
 
it's integrated in Visual Studio vOv
 
6:24 PM
i mean the one in windows kits is not there and also i cannot find a memory debugger in my vs2017
i have found something in performance profiller i willl give that a go
 
Debug -> Windows -> Memory -> Memory 1
and type in the address
 
there is no memory or memorty 1 in vs studio 2017
at least not in mine
 
There is
 
nope
i will post a screen shot
 
I literally tried this in MSVS2017
you need to be running the debugger and have a breakpoint in the place where you got that message
("Start Debugging" and like)
 
6:28 PM
ok will try
ok i got it when debugger is going but it tells me unable to run while debugger is running
ok now its working
unfortunately all i see is a bunch of ?? ?? ?? ?? ?? as i am going through the addresses
so i guess either i am not asking the server the right thing or the server hates me lol
jk propbably me not doing the right thing
looking at the master server query page this should be easy to acheive, i think not
well tnx for you help
 
6:45 PM
@Ambush remember you're getting back binary, look at the bytes not the characters
 
ok i will try that, tbh i have done pretty well so far i created my sockets etc sent messages received data, i will get this as well !
 
 
4 hours later…
10:20 PM
hey all, i have been messing around with my code and changed the char array to an an unsigned char array and then output the data using string stream as int, i am 100% not sure if i am on the right track but my output now looks as follws
25525525525510210862214516810514986221451681051418622145168105137862214516810515‌​78622145168105162862214516810515086221451681051408622145168105161862214516
 
introduce separators and hexadecimal notation and someone may think about looking at this
 
ok i will try, was just wandering if i was on the right path or not
as it looks like ip and ports
i did check tho and they didnt look like game servers tbh
 

« first day (486 days earlier)      last day (2371 days later) »