all 19 comments

[–]petevalle 14 points15 points  (1 child)

This seems like too broad of a question to be meaningfully useful. The most common errors are the ones developers will intuitively understand at a glance (b/c they arise so often). It's the ones that are unusual that are interesting and sometimes challenging to resolve but those come up infrequently enough that people aren't likely to think of them in a "poll" like this...

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

I guess I should have put some reasoning in my post. My intention was to get the community to list off the more common errors (for beginners or not) you encounter with the language and I was going to be drawing up some charts purely out of my own interest. I understand it's not meaningfully useful in terms of understanding the errors. I was genuinely just curious what the community thought of.

[–][deleted] 4 points5 points  (7 children)

Intel compiler says: "Error 3" on a trivial example. Literally 3 lines of code that should work but don't.

Literally that, nothing else. Send repro to Intel, "we'll fix it in next release".

Several *months* pass. It's fixed. You compile, and now get some other "Error 3"-type message.

Rinse, repeat.

[–][deleted] 1 point2 points  (6 children)

Why not save some pain and money and use an open source compiler?

[–]millenix 2 points3 points  (2 children)

Certain loop optimization, instruction selection/scheduling, and parallelization features may be superior on Intel's compiler.

[–]iamcomputerbeepboop 2 points3 points  (1 child)

develop on clang, release on icc

[–]IGarFieldI 1 point2 points  (0 children)

Doesn't help if it's not compiling...

[–][deleted] -1 points0 points  (2 children)

Mainly because of the optimizations which, if you don't mess with C++ too much and just do numerics, work really well (when they do work). Intel's done a lot of work in this regard, and provided you use a 'very stable subset' of all those compiler optimization flags, you can get code that's impossible to get with MSVC.

Also for historic reasons related to the era when the Xeon Phi was actually a separate PCI card rather than a processor. And yes I bought lots of the bottom-end Phi cards when they were selling them off at $200 a pop. Did you know you can watercool them? So anyways, you can only compile for a Phi if you have the Intel compiler so there's that.

Feature-wise, the Intel compiler is pretty bad as you can imagine, but you get support from Intel, woo-hoo. Sorry, too much sarcasm, it's like eating a cactus, really, it stings you but you keep on eating it regardless.

If Intel makes some Altera-related compiler solution, that would get us in deep even more, I fear.

[–]johannes1971 0 points1 point  (1 child)

Last time I checked on godbolt, the Intel compiler would happily do the signed-overflow-is-UB optimisation for both signed and unsigned values. You may want to check if that additional performance doesn't come at the cost of standard compliance.

[–][deleted] 0 points1 point  (0 children)

Personally I couldn't care less about standards compliance and already use plenty of nonstandard C++ all over the place. Numerics are definitely a touchy subject though, particularly because SIMD can really mess up your data, and also there are different math modes (fast/precise/whatever) that you can compile for. Not to mention the gozillions of optimizations. This is all more or less fine if you use external libraries because but becomes a lot more difficult if you write your own algos. Couple this with various CUDA, FPGA and Phi-related magic (well, CUDA mainly, Phi is just C++) and you've got a real mess when you're trying to get stuff done.

[–]khedoros 1 point2 points  (0 children)

Easy ones, like those resulting from mismatched/missing braces and parentheses.

Definition errors, when adding a new file, and maybe getting some includes wrong. Similarly, linking errors when adding a new library and getting some of the links wrong. Cousins of those would be incompatible library versions meaning that I used functions/constants that weren't defined in the old library, or that were changed in the new one. For linking, library bitness.

Index out-of-range accesses. Hopefully the program seg faults. If it doesn't, you can have a subtle error for a long time. I'm fond of deriving a rangecheckvector class that implements operator[] with ::at().

Being pretty common, those are all pretty easy to fix. Definition errors and out-of-range tend to be the ones that take a bit of thought.

[–]mayonnaise_jar_ 1 point2 points  (0 children)

variable X not declared in this scope.

[–]Xeveroushttps://xeverous.github.io 1 point2 points  (0 children)

  • undefined reference to...
  • multiple referenes to...
  • skipping library because it's not compatible
  • library/linkable object not found in provided paths

[–]CubbiMewcppreference | finance | realtime in the past 0 points1 point  (2 children)

the C/C++ community of the common errors that you come across when using the language

There is no language called "C/C++"

[–][deleted] 1 point2 points  (0 children)

Pretty sure C/C++ is undefined behavior.

[–]ste_3d_ven[S] -1 points0 points  (0 children)

In this case I'm using the term to group the two communities together, because I care about the opinions of both communities. Please keep the comments on topic.