Stream

Join this community to post or comment

Sean Richards

Knowledge Sharing  - 
 
I get what this guy is saying.  However, I think he has some valid points.  I am curious to see what you guys think.  (Hint, this will probably start a debate).
10
1
Arnon Marcus's profile photoMat Sutcliffe's profile photoFrancisco Evangilo's profile photo
11 comments
 
They don't use the standard library containers because they will have their own finely tuned container templates. Compile times evaporate in the heat of 500 CPU cores and IncrediBuild grid engine.
Add a comment...

José Ramírez

Newbie Discussion  - 
 
Hi! We are trying to port a large Delphi project to C++ but don't know exactly what GUI framework to use. Options on the table are MFC or WxWidgets, however atleast MFC has a solid designer built in to Visual Studio. Is MFC still used in production these days? 
2
Paolo Brandoli's profile photoMartin McDonough's profile photo
28 comments
 
You can test any Linux program with valgrind, and almost all GUI toolkits support Linux.
My main complaint with Qt is that it is a huge library, just epic sized, extraordinarily complex and overkill for almost any project at all.
Add a comment...

Арсен Гоян

Newbie Discussion  - 
 
Hi! I'm a beginner programmer and I'd like to ask a question.
I have troubles with random number generation.
I know about the rand() function.

I'm interestred in a different way of random number generation.
What I do is I take a seed (e.g. 37)
and for each new number in the sequence (array) I do:
a[i] = (2343 * A[i - 1] + 2874) % 50 + 1;
I think you get what I mean.

Nevertheless, what i get as a result is a sequence like:

37, 16, 13, 34, 37, 16, 13, 34, 37...

I don't uderstand what is the problem and why does the program make this ugly pattern of 4 numbers it definitely shouldn't make.
Changing the seed does not help.
Patterns also appear using the default rand() function, even when srand(time(0)) is set...

Thanks in advance =)
2
Denisss Novikov's profile photoPratyush Kumar's profile photo
18 comments
 
+Арсен Гоян try using the random function and found further to our randomize() with appropriate have file
Add a comment...

lahlali issam

Compilers & Tools  - 
 
CppDepend 6 Just Released!
After 7 years of development, CppDepend reached a certain level of maturity. Yet there are still many new potential features and improvements possible. We found out that the most sensitive part for this version 6 was actually to chose carefully the…
4
1
Pat Le Cat's profile photolahlali issam's profile photoSebastian Binder's profile photo
6 comments
 
+Pat Le Cat It's not a speculation. I'm from the CppDepend team and it's what you got as needs and feedback from our clients.
Add a comment...

Juan Pablo Crossley

Knowledge Sharing  - 
 
Hi guys,
I've been reading some of the nice features about C++11, and the incoming standards, a couple of the C++11 features seems to be a good fit for part of the code I wanted to improve, but when I tried to do a proof of concept I got an error saying that this and that is not defined, doing further investigation the g++ coming with Ubuntu seems to have this flagged as "experimental" and you need to pass an argument to activate these experimental code, but... I don't really want to use experimental code in my production code, so wondering why is still experimental? my app should be compiled in windows, linux and OSX, and I really dont want to start doing code to later realize that is not supported in all the platforms, compilers, etc.
Should I wait for another 3 years to start using what was defined 4 years ago? Are you using this features in production code running multiplatform? what about leakage, and normal bugs of unstable code, did you get some of these for daring to use c++11?
1
Mat Sutcliffe's profile photoFrank Severino's profile photo
14 comments
 
There's more than one way to skin a cat.
BTW, how would someone know there's more than one way to skin a cat?
: )
Add a comment...
2
Isaque Galdino's profile photoJulio Cesar Pérez Franco's profile photo
7 comments
 
Then FLTK is the best, is a bit awkward, but has little or no dependencies, the sources are small and with CMake you can simplify the design/code-writing.
Add a comment...
 
So I am reading a book called From Mathematics to Generic Programming.  I am returning to review some of the code so I am follow what is happening.  I hand wrote out the code and stepped through it and I am making some assumptions but wanted to confirm my assumptions before taking them on for facts.

int multiply0(int n, int a)
{
    if(n == 1) return a;
    return multiply0(n-1, a) + a;
}

n is the number of times we add the numbers together.

The method is recursive (no brainer).  However, since the method only really does one things (checks to see if n == 1.  My assumption is then that this method truly represents is n-1, a) + a adding up based on the iterations of n.  In this case we are subtracting 1 from n until we hit zero.  There for is we add 2 + 2 + 2 + 2 + 2 = 10.

Would that be accurate?  
2
Robert Hansen's profile photoLevKozlodoev's profile photo
22 comments
 
+Robert Hansen The compiler is smart but not that smart. It's not going to always optimize your code perfectly. This is even the case for the Intel C compiler under Intel processors; I've worked with people from Intel.
I'm more than certain the authors of clang weren't looking into cases like these because most people don't write code like that.
Add a comment...
 
This is a work of a genius. Not a single phrase wasted. Everything on point
98
33
Timothy Lester's profile photoMuhammad Haseeb's profile photoPavel Kozlovskiy's profile photoCarl G Pretorius's profile photo
33 comments
 
+Juan Pablo Crossley No problem, glad to help. :)

After a few years of considering it, that Sean's talk was what finally pushed me to change the curriculum for my C++ course (one of my life roles is to be a T.A. at Uni) to focus more on generic stuff and templates, and leave the old ways of teaching C++.

If you're checking the algorithms, I also recommend the boost.range library, and also +Eric Niebler's range library which should become a part of C++17 (hopefully).

C++ is a rather strange beast that can surprise you even after a decade of using it.

After all that, when you feel rested and relaxed enough (trust me, it is a prerequisite :) ), and when you get a feel for a few of the uncommon concepts (at least, uncommon for the OO world), I recommend Alexandrescu's "Modern C++ design". After that, I don't think you'll ever call C++ an object-oriented language. :)

I think the world is ready for a book named something like 'Effective Functional C++', or 'Effective Generic C++' or something similar. :)
Add a comment...

jorge chavez quinto

Newbie Discussion  - 
 
Hi there, I'm new user of C++, and I'm learning about dynamics arrays and I want to initialize  a dynamic array with values;
for example in normal array I do:
int A[100]={0,3,4,5,....};//for 100 values
but in dynamic array later on create the array:
int *A= new int[100]; //for 100 values
how can I input values easily like in the normal array?.
thanks in advance.
2
Andrea Bontempi's profile photoPaolo Bolzoni's profile photo
6 comments
 

Or the Herb Sutter favorite: 
auto v = std::vector<int>{1,2,3,4,5, ... };
Add a comment...

Christian Kakesa

Knowledge Sharing  - 
 
#cppnow 2015 presentations http://kiq.li/T3t
cppnow_presentations_2015 - Presentation materials for C++Now 2015
6
Add a comment...
 
What do you guys think about the Rust language? After C++, for a looong time, it's the first time some language can penetrate my mind and earn my attention.
A systems programming language that runs blazingly fast, prevents almost all crashes, and eliminates data races.
9
Robert Dailey's profile photoVinícius dos Santos Oliveira's profile photo
14 comments
Add a comment...

About this community

A community dedicated to C++ professionals and enthusiasts. ======================================                       COMMUNITY RULES ====================================== ⇨ NO CODE in posts or comments! ⇨ NO IMAGES OF CODE in posts or comments! ⇨ No job postings or advertisements! ⇨ Post in the appropriate category ⇨ Comprehensible English ONLY ⇨ Search before asking questions ⇨ Be mature! No profanity, no flaming, etc. ====================================== ** READ THE FULL RULES LINKED BELOW! ** If you need to share source code, do so by using a separate website and share a link to it (pastebin.com, ideone.com, etc). Link to rules for mobile: http://goo.gl/9ImE5j

Kamil Mahmood

Newbie Discussion  - 
 
This problem is Number System related.

We can easily convert integers from one base to other. We can also convert decimal float to other bases but how can we convert float Hexadecimal, float octal and float binary to float decimal.

Float Decimal to Float Binary

2.65 = 10.101001100110 approx

We deal it like separate it into two parts 2.0 and 0.65
and convert both parts independently and then rejoin.

How can we convert back 10.101001100110 to 2.65

I am not native English speaker.
2
Casey Webster's profile photoKamil Mahmood's profile photo
5 comments
 
+Casey Webster How can we convert  10.101001100110 to  01000000001010011001100110011010
Add a comment...

Pat Le Cat
moderator

Compilers & Tools  - 
 
Atom 1.0, the code editor for the whole family as you can see in this clip from the 60s :D

https://youtu.be/Y7aEiVwBAdk
32
11
Ladislav Jech's profile photoJens Kapitza's profile photoJeongSeok Han's profile photoMarco Abecasis's profile photo
9 comments
 
I must say I just compiled the new update and it opens much faster than before
Add a comment...

Beldì Luca

Design & Idioms  - 
 
I have a question regarding templates methods in classes with private implementation.
The small example attached won't link correctly because the template method is defined in the cpp file but since I cannot include myclass_p.h in myclass.h (that's the whole point of private implementation) how can I make it work?
Thanks in advance
3
1
Guillaume Racicot's profile photoFlorian Philipp's profile photopooja gandhi's profile photo
11 comments
 
+Beldì Luca In your example, there is indeed no way to avoid exposing your pimpl. In other cases, there are. Imagine you were to implement std::list<T>. Everything that has to do with the structure of the list (traversal, reversal, sorting, etc) is independent from T. So you can put all related methods and attributes into a base class (and pimpl) for all lists. That way, you can minimize the amount of exposed code, though you cannot completely avoid it.
Add a comment...
 
Hi guys,
today I decided some of new features in C++14, and now I have a doubt. What is supposed to be the "return type deduction" because, for me, it doesn't seems to be sooo useful. I mean, I know, it's good in some cases, but, at the first time, I thought, we can make different return types. For example, the same function can return a int and a float. But the truth is "no, I can't"
So, the "return type deduction" get, the function return type, and, it's just that, right? So, what is the real purpose of "return type deduction" ?
Thanks :)
2
Joshua Underwood's profile photoBernardo Vieira's profile photo
11 comments
 
+Daniel Jour wow this is great actually. I will try, for sure :) Well, I learned some languages until now, but, it's start to become really easy, because, if I say, I learned, C,C++,JS,PHP,Python,Matlab,R,Assembly, you will realize that, the most different language is Assemblly. Python and R is little different to. But the other is not so different. That's why I decided to read this book. Because I need new experiences.
+Joshua Underwood yeah, I love to program :)
Well, you got a point!
Add a comment...

Pavel Ryzhov

Compilers & Tools  - 
 
Visual Studio Extension for С/C++ code analysis, refactorings, templates and coding assistance
4
Binshuo Hu's profile photo
 
I am wondering whether there is a counterpart in Resharper C++ of the outline view function in Visual Assist X?
Add a comment...

Jure Repinc

Libraries & Frameworks  - 
 
 
KDE today announces the release of KDE Frameworks 5.11.0. KDE Frameworks are 60 addon libraries to Qt which provide a wide variety of commonly needed functionality in mature, peer reviewed and well tested libraries

#KDE #Qt #CPP #CPlusPlus #Programming  
3 comments on original post
7
Add a comment...

Jon Dubovsky
moderator

 - 
 
I was doing a big grep on a code archive directory and found the following gem from my first job, related to me by a coworker at the time who had survived the Frankenproject that spawned it:

/* all the old [redacted] functions now return error codes */
# define void int
14
1
Steve Simpson's profile photoRobert Dailey's profile photoNIkolai “Zeks” Marchenko's profile photo
6 comments
 
What's worse, we continue to accept half-ass solutions openly. Even when we discuss in principle why we shouldn't do those things. It's a common pattern I see.
Add a comment...
 
Querying C++ on Google Map. How about yours :)
20
3
Robert Dailey's profile photoPallavi Nartawar's profile photoMauro Risonho de Paula Assumpção's profile photoDaniyar Tleulin's profile photo
7 comments
 
Why isn't it nice to work there? I looked into salaries for C++ developers in Japan, but it was very low compared to what you can get in the US. Cost of living seemed high too, compared to where I live (Dallas, TX).

Love Anime culture in Japan, which is why I find it so interesting.
Add a comment...

Zsolt Szatmári

Libraries & Frameworks  - 
 
Hi!

Do you know about an STM (software transaction memory) library for c++ which is lightweight (preferably just some files to drop into your project), has wide compiler support (vs2013+, clang, gcc, iOS, android), reliable, hard to use incorrectly (think RAII), and works well?

I like Haskell's built-in approach, as a reference.

I can imagine this by passing a lambda to a library function, which in turn gets some kind of handle as an argument.
2
Brett Cooper's profile photoZsolt Szatmári's profile photo
2 comments
 
No links, I need a library like that, curious of what you can advise.
Add a comment...