endl 'semantic error' in Rel2.6.020

Discussion to talk about software related topics only.
Post Reply
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

endl 'semantic error' in Rel2.6.020

Post by Ridgeglider »

Hi guys. At long last I'm taking Tod's advice to eliminate printf in favor of cout. it's working nicely but the codan module in Rel_2.6.020 seems to be telling me that my usage of endl is a 'semantic error' with the following code and includes configured. The file starts with:

Code: Select all

using  std::string;
using  std::cout;
using  std::endl;
using  std::cin;
if instead I say:

Code: Select all

using namespace std; 
I get an error telling me 'std' is ambiguous, and endl throws the same errors.

Finally, in either case, even though these "bug icon" errors are flagged, the code builds successfully. What do I need to do to make endl tolerated?
Here's the code and the error:
endl error.png
endl error.png (23.09 KiB) Viewed 2380 times
Here are the includes:
endl error includes.png
endl error includes.png (30.18 KiB) Viewed 2380 times
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: endl 'semantic error' in Rel2.6.020

Post by tod »

First, welcome to the C++ stream library club. Maybe when others start adopting the 5441x family the club membership will grow since memory is unlikely to be an issue any more.

Secondly, let me not be responsible for propogating the endl fiasco (as Alexandrescu has dubbed it). Endl puts out a new line AND flushes the buffer. If you want to do both it's very convenient. If not it can be inefficient and I have been guilty of overusing it in the past.

I don't have this problem and the only difference I see is one include path you don't have. (You also have one I don't have but that shouldn't cause a problem but just in case, attached is an image of the three gcc-m68k includes I put in every project.
GccIncludes.png
GccIncludes.png (7.31 KiB) Viewed 2373 times
Post Reply