How to view g++ long error message


I am using g++ to compile a program. g++ outputs so many warnings and errors that I cannot see the first error message that I think I should fix first I try to use 'g++ exer.cc | less' but it ...
Posted On: Sunday 25th of November 2012 10:08:44 PM Total Views:  59
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




C/C++ Interview Programming Questions

C Questions
VIEWS ON THIS POST

63

Posted on:

Wednesday 17th October 2012
View Replies!

Peer Review Request - BinaryTransform Iterator

I need an interative form of the std::transform algorithm. In other words, instead of letting transform do its work and accessing the results afterwards, I need to access each transformation as it occurs. The reason is that if I rely solely on std::transform, I would have to make several calls to it storing the results in buffers. While this would look nice, it implies a lot of looping in the background. So I've written a "BinaryTransformIterator." The idea is to run several of these iterators in one loop, manipulating and combining the results as I go along. The hope is that this will make my code more concise. However, at this point this exercise is more of an experiment; I'm just playing around at present. I'm not sure yet if it's useful. At any rate, I'm hoping for comments and about the correctness of the code and any suggestions for improving it. template class BinaryTransformIterator : public std::iterator { private: typedef BinaryTransformIterator self; InputIterator1 myFirst1; InputIterator1 myLast1; InputIterator2 myFirst2; BinaryFunction myFunction; value_type result; public: BinaryTransformIterator() { myFirst1 = myLast1; } BinaryTransformIterator(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryFunction function = BinaryFunction()) : myFirst1(first1), myLast1(last1), myFirst2(first2), myFunction(function) { if(!IsDone()) { result = myFunction(*myFirst1, *myFirst2); } } bool operator==(const self &other) { return this->IsDone() == other.IsDone() true : (this->myFirst1 == other.myFirst1) && (this->myLast1 == other.myLast1) && (this->myFirst2 == other.myFirst2); } bool operator!=(const self &other) { return !(*this == other); } value_type operator*() { assert(!IsDone()); return result; } self &operator++() { assert(!IsDone()); ++myFirst1; ++myFirst2; if(!IsDone()) { result = myFunction(*myFirst1, *myFirst2); } return *this; } self operator++(int) { assert(!IsDone()); self temp = *this; ++myFirst1; ++myFirst2; if(!IsDone()) { result = myFunction(*myFirst1, *myFirst2); } return temp; } private: bool IsDone() const { return myFirst1 == myLast1; } }; // TEST typedef BinaryTransformIterator iterator; int main(void) { float buffer1[] = { 1, 2, 3, 4, 5 }; float buffer2[] = { 2, 2, 2, 2, 2 }; iterator first(&buffer1[0], &buffer1[5], buffer2); iterator last; for(int i = 0; first != last; i++) { assert(*first == buffer1[i] * buffer2[i]); ++first; } return 0; }
VIEWS ON THIS POST

39

Posted on:

Saturday 3rd November 2012
View Replies!

Singleton overview

I have a 481 line text document at 80 characters per line. It's a brief overview of globals, singletons, the static initialization order fiasco, the static de-initialization order fiasco, and double checked locking. I'll be basing a presentation to my colleagues on this little draft. In it, I do a quick overview of the concepts, what works, what doesn't work, and why. It contains nothing new, and it's not particularly formal. I was wondering if this was a proper venue for posting such a thing for comments and criticism, and if not, what would be In the interests of brevity, the things I'm most interested in are: -1- (A little beyond the scope of C++98, but in scope for C++0x). If one programs with the Java 1.5 memory model guidelines in mind, will this work with C++98 on all major operating systems with all major threading libraries C++0x -2- I'm paranoid when it comes to problems like this. I dislike how the standard singleton interface returns a pointer to the singleton. I have thought about making the suggestion that instead of a getInstance function, you declare global functions in the header file. These global functions are defined in the cpp file to use the singleton. Thus the user is unable to get a reference to the singleton, and thus cannot cause static de-initialization order problems. -3- I know the C++98 standard does not address threads, but if statics are initialized during a multi-threaded situation, will all major compilers still destroy them in the exact opposite order This implies some locking overhead during the "first pass" over function local statics, as the compiler has to create a hidden global list of static objects to use to determine the order of static de-initialization, and update it whenever a static constructor exits. As two different function local statics can be initialized concurrently, access to this list must be synchronized for correct results. -4- I believe I have an implementation for a singleton in C++98 so that the following are true. (I was wondering if I missed anything.) -4-a- It is lazily initialized. It will be initialized on first use, which may be after main has started. -4-b- It is thread-safe, a.k.a. the singleton is guaranteed to be constructed only once. -4-c- There is synchronization at most for the first call from each thread. Later calls have no synchronization. -4-d- It will be destroyed during static de-initialization. -4-e- It does not any static initialization order problems nor static de-initialization order problems. (Assuming this singleton does not use other singletons. If it does, as long as it references all needed singletons in its constructor, all static order problems are gone.) -4-f- It is otherwise correct. Here is the "implementation", which may require implementation specific code, but I don't think so. What it does is replace synchronization overhead in all cases with an extra level of function indirection in all cases. It was inspired when a Java friend of mine claimed that Java could have a singleton in a multi-threaded environment with all of the guarantees I've listed (except 4-d, static de-initialization). I at first said impossible, but it struct me how the JVM could do it by swapping out a virtual function pointer in the virtual function table after the first call. I do something similar here. //.hpp file class Mutex {}; //from another header file class Guard { public: Guard(Mutex&); }; //from another header file void function_1(); void function_2(); //.cpp file #include namespace { class T { public: void function_1(); void function_2(); }; Mutex & functionContainingStaticMutex() { static Mutex m; return m; } struct ForceInstantionOfMutex { ForceInstantionOfMutex() { functionContainingStaticMutex(); } } instance_ForceInstantionOfMutex; T& synchronizedCall(); T& unsynchronizedCall(); //initialization of POD types with constant expressions //is guaranteed to occur before runtime. T& (*funcPtr)() = &synchronizedCall; T& functionContainingStaticT() { static T t; return t; } T& synchronizedCall() { Guard g(functionContainingStaticMutex()); T& t = functionContainingStaticT(); funcPtr = unsynchronizedCall; //You need a memory barrier here. You need an implementation //specific instruction to prevent another core from seeing //funcPtr == &unsynchronizedCall and t partially initialized. //The problem is that a core may load funcPtr into its cache //without calling getSingleton(). For example, it may load //the address right next to &funcPtr during some other operation, //and it just happens to load the addresses around it as well //to the cache as a kind of look-ahead-like optimization. return t; } T& unsynchronizedCall() { return functionContainingStaticT(); } T& getSingleton() { return funcPtr(); } } void function_1() { getSingleton().function_1(); } void function_2() { getSingleton().function_2(); } -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
VIEWS ON THIS POST

53

Posted on:

Sunday 4th November 2012
View Replies!

Data Structures and ****ysis Multiple Choice review

Distant learning course. This is a self-taught open-book test. I have read the book over & over, I even found a PDF version and searched it. I've combed the net and found some good resources like NIST.gov. After my other tests I have asked the on-line instructor for references, or even the correct anwser to what I missed. She has proved useless.I have a few here I would like some opinions on, i have tried on my own, but would like some tutoring . 1. A cyclic graph has: a. a shape like a unicycle b. a graph that cycles from vertices to edges c. a cycle of two or more nodes d. a cycle of three or more nodes e. None of the above I'd say d, because a cycle graph consists of a single cycle (some number of vertices connected in a closed chain) 2. A(n) _______________________ graph is a graph in which each vertex has a connection to every other vertex. a. directed b. cyclic c. acyclic d. fully connected e. None of the above I'd say e, because I belive it should be either a connected graph or a strongly connected graph, depending on where you read about it. Fully connected sounds close, but I can't find a single reference to that. 3. A(n) ____________________ is a graph in which each connection has two directions. a. undirected graph b. bigraph c. bidirectional graph d. TS graph e. None of the above I'd say e, I've found no graph that has an edge going both ways
VIEWS ON THIS POST

48

Posted on:

Sunday 4th November 2012
View Replies!

Data Strct & Algorithm ****ysis - Review Anwsers Please

I am stuck on a few open-book multiple choice questions for this class. I have answers, but I can not back them up. Any insight would be helpful, a link to read, or just hey dummy you are wrong. thanks A(n) ______ is another way of writing a logarithmic equation. a. exponetial equation b. instruction function c. time complexity (MY CHOICE) d. linear equation e. none of the above The result of a logarithm is a(n)__________ a. instruction b. exponent c. base d. variable (namely, n) (MY CHOICE) e. none of the above The public section of a class is also referred to as the _______ a. class interface b. maintenance area c. data member function d. class implementation e. none of the above (MY CHOICE)
VIEWS ON THIS POST

38

Posted on:

Sunday 4th November 2012
View Replies!

Submitting a Primitive Library for Peer Review

I've been trying to create a basic file obfuscation library using the XOR operator because I heard that it was fast. Because of the suggestions of those at the comp.lang.c++, I have decided to turn the library into a file obfuscation library. More details are available at http://groups.google.com/group/comp....7859cceff1c34# First, however, I would like to submit my previous code for peer review. I know it is very basic. I know that loading a file into memory via std::string is a bad idea, but as I posted in comp.lang.c+ +, it is a temporary measure. I haven't tried using ios::binary yet (that's what the people at comp.lang.c++ recommended). I would like to have all forms of suggestions. Note: as I said above, I am going to turn the library into a file obfuscation library. I am going to rename the class to FileObfuscator or something. So here goes a bit of my questions: * What do I need in order to improve the performance/design. * How can I bypass the out-of-place EOF character in the middle of a binary file Does the flag ios::binary help * Are there any other fast obfuscation methods out there * Is there an alternative to loading a file onto the memory via std::string I did it in the first place because I didn't know how to encode the file with fstream. Therefore, I had to load a file with std::ifstream, then write to it with std:fstream. So the question may be rephrased as...how can I XOR-encode or ROT13-encode a text/ binary file with fstream Please post some examples! You may download the library at: http://ftp11.ohpy.com/opftp/index.ph...zlbrextnsn.zip -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
VIEWS ON THIS POST

40

Posted on:

Sunday 4th November 2012
View Replies!

Access to HTML code of the page viewed in TWebBrowser

I want to write a program which loads the webpage and refreshes it every e.g. 5 minutes. If some information on this website is updated, it notifies the user. To do that I need to have access to HTML code of the page viewed in TWebBrowser component, but I don't see any obvious way to do that (I'm just a student with little experience).
VIEWS ON THIS POST

71

Posted on:

Sunday 4th November 2012
View Replies!

Guitar Reviews

Custom guitar, acoustic guitar, electric guitars, reviews, specifications, pictures, prices, all here!!!!! http://pro-guitars.blogspot.com/ Free guitars!!!! http://freeguitars.blogspot.com/
VIEWS ON THIS POST

23

Posted on:

Sunday 4th November 2012
View Replies!

Interview befuddlement

I've had four technical interviews with the same company (and one Brainbench exam), and every one of the interviewers asked me what the vtable looked like. Is this common One of them also asked me about how the code and data segments were laid out in memory for N number of instantiated objects. There were plenty of other questions about inheritance, polymorphism, composition, RAII, as well as Unix specific questions about IPC, threads, etc, as this is for a C++/Unix architect/developer position. I just found the repetitive vtable questions puzzling.
VIEWS ON THIS POST

34

Posted on:

Sunday 4th November 2012
View Replies!

interview question (easy or hard?)

Hi I was asked to propose an interview question for C/C++ programmers (CAD/CAE software) I came up with the following ---------------------------------------------------------------------------------------- float fun(float value) { float f1 =0., f2 = value; float tol = value/1000.; float result,tmp; while(1) { result = (f2+f1)/2.; tmp = result*result-value; if(fabs(tmp)0.) { f2 = result; }else { f1 = result; } } return result; } 1. What is the result of the above approximate algorithm a) value modulo 1000. b) square root of value. c) pi 2. Which of the values below is closer to the return value of fun(9.) a) 3. b) 3.0015 c) 3.1415 3. For which of the values below the while loop does not end a) 0. b) 0.5 c) 1. 4. Correct the previous bug. ---------------------------------------------------------------------------------------- What do you think is the difficulty level of the exercise Any other comments regards Kostas , On Nov 22, 11:36 pm, "Alf P. Steinbach" wrote: > * kostas: > > > Hi > > I was asked to propose an interview question for C/C++ programmers > > (CAD/CAE software) > > There is no language C/C++, just as there is no language Java/C++. But behind a lot of software projects there is plenty of C/C++ code I am afraid :-) Thank you for your comments Kostas
VIEWS ON THIS POST

82

Posted on:

Sunday 4th November 2012
View Replies!

Urgent walkin interviews from top rated companies

Dear Job Seekers, Greetings from walkincareers.com - The Ultimate Walk in jobs Portal. For the Walk-In drives across India kindly log on to the site : ********************************************************************** To get the details about all IT openings click the link www.walkincareers.com/itwalkin.php&id=IT To get the details about all Non-IT openings click the link www.walkincareers.com/itwalkin.php&id=NON%20IT To get the details about fresher openings click the link www.walkincareers.com/walkin.php&id=Fresher For latest jobs posted for your reference do visit the following links. http://www.walkincareers.com/jobs_feb/main.html http://www.walkincareers.com/jobs_feb/page1.html http://www.walkincareers.com/jobs_feb/page2.html ********************************************************************** For current openings with companies and walk in drives refer www.walkincareers.com and register your mail id for the mailing list which will carry the information about the current walk in drives posted at our site.
VIEWS ON THIS POST

55

Posted on:

Sunday 4th November 2012
View Replies!

Optimizing class layout for a file viewer

I am writing a file viewer and struggling on how to layout the basic classes optimally. There will be the ability to view multiple files at once, and there will be a user defined number of windows each viewing into the opened files. It is possible for several of these windows to view into the same file and scrolled to different parts of it. Assigning what file a window is viewing can be changed on the fly as can the number of windows. What basic classes, inheritance, and such would be a good setup for this The answer is probably simple but I am just not able to come up with anything elegant yet.
VIEWS ON THIS POST

69

Posted on:

Monday 5th November 2012
View Replies!

Gross violation of Scientific Ethics, abuse to Peer Review publication system and misuse of Name of CERN in News Groups. BY Dr Alexander Inpain ( he claims he is in CERN), Email rambus2005@yahoo.com

Gross violation of Scientific Ethics, abuse to Peer Review publication system and misuse of Name of CERN in News Groups. BY Dr Alexander Inpain ( he claims he is in CERN), Email rambus2005@yahoo.com It is being submitted in the interest of progress of Science /Phyics Theme: My research papers published in international journals and CONFERENCES after PEER REVIEW confirms that Einstein\ts Sep 1905 derivation leads to inconsistent prediction under some conditions. When body emits light energy, ITS MASS MUST INCREASE. Part I Rebuttal (on internet News Groups) of Dr Inpain of CERN ( as he claims) ABSOLUTELY support my work, if he puts angle phi equal to 89 ( as I have done in my paper) In his NOTE eq.(1.5) is K0- K1 = L( -1)-L cos (1.5) Then and put angle ( phi ) equal to 89 degree (cos89 = 0.01745). Equation (1.5) becomes K0- K1 = Lv2/2c2 - L [ 0.01745] Einstein worked in classical conditions and hence applying Binomial Theorem Mb-Ma ( \tm ) = L/c2 \t2Lv/c [0.01745] = L/c2 \t0.0345L/cv ( 1.5 ) Now if you see my paper A. Sharma, Physics Essays, 17 (2004) 195-222. \tThe Origin of Generalized Mass-Energy Equation \tE = Ac2 \tM; and its applications in General physics and Cosmology\t. http://www.burningbrain.org/pdf/ajaysharma_einstein.pdf It is same equation as eq.(13) i.e. Mb-Ma ( \tm ) = \t 0.03490L/cv + L/c2 (13) So it is sheer folly of rambas2005@yahoo.com, that his conclusions support my work BUT HE DOES NOT REALISE THE SAME. or Ma (after emission of light energy) = \t0.03490L/cv \t L/c2+ Mb ( before emission ) Thus under this conditions, according to Einstein\ts Sep 1905 paper when light energy is emitted , its mass increases rambas2005@yahoo.com ( NAMELESS , PLACELESS ) has written about 500 posts showing his own folly, compelling me to write this. Author/Editor/Referees are all correct. Part II Scientific bodies and Internet Groups must take stern actions against individuals who are working against the SCIENTIFIC sprits. So this letter is being posted at Webs, sent to CERN authorities, scientific bodies, Universities etc. AJAY SHARMA 29 Sep 2006. physicsajay@rediffmail.com References of Einstein\ts work .. A.Einstein, Annalen der Physik 18 (1905) 639-641. .. DOES THE INERTIA OF A BODY DEPEND UPON ITS ENERGY-CONTENT Weblink is Einstein\ts 27 Sep 1905 paper available at http://www.fourmilab.ch/etexts/einstein/E_mc2/www/ Part II References of Ajay Sharma\ts work My work is available at A. Sharma, Physics Essays, 17 (2004) 195-222. \tThe Origin of Generalized Mass-Energy Equation \tE = Ac2 \tM; and its applications in General physics and Cosmology\t. http://www.burningbrain.org/pdf/ajaysharma_einstein.pdf For details https://www.novapublishers.com/catal...oducts_id=4554 International Conferences It has been accepted for presentation over 55 conferences all over the world --------------------------------------few of them 1. Sharma, A. presented in 19th International Conference on the Applications of Accelerators in Research and Industry , 20-25 August , 2006 Fort Worth Texas, USA 2. A. Sharma, Abstract Book 38th European Group of Atomic Systems ( Euro physics Conference) Isachia (Naples) Italy (2006) 53. 3. A. Sharma , Abstract Book , A Century After Einstein Physics 2005 , 10-14 April 2005 ( Organizer Institute of Physics , Bristol ) University of Warwick , ENGLAND 4. A. Sharma presented in 5th British gravity Conference, OXFORD ENGLAND 5. Sharma, A Collegium Logicum Volume 9, pp. 58-62 Springer-Verlag, Germany (2006) 6. A. Sharma,. Proc. Int. Conf. on Computational Methods in Sciences and Engineering 2003 World Scientific Co. USA , (2003) 585. 7. A. Sharma, Proc. Int. Conf. on Number, Time, Relativity United Physical Society of Russian Federation, Moscow , (2004) 81 plus more -------------------------------------- Journals 1. This paper \tThe Origin of Generalized Mass-Energy Equation \tE = Ac2 \tM; and its applications in General physics and Cosmology\t. is published in journal Physics Essays , CANADA www.physicsessays.com 2. The paper 2. The past , present and future of E=mc2 will be published in 2007 Galilean Electrodynamics, Massachusetts, USA. 3. A. Sharma, Concepts of Physics, Vol. III No. 4 (2006) 345-373 In parts it is published and is UNDER PUBLICATION in various others journals. ---------------------- Book 100 Years of E=mc2 For details https://www.novapublishers.com/catal...oducts_id=4554
VIEWS ON THIS POST

194

Posted on:

Monday 5th November 2012
View Replies!

Re: IT - Jobs, Interview Questions, Certification

And spamming your prospective clients helps too! Or, did you have a C++ language question
VIEWS ON THIS POST

35

Posted on:

Wednesday 7th November 2012
View Replies!

c and C ++ viewers

http://ganesh-freedotnetbooks1.blogspot.com http://ganesh-freedotnetbooks.blogspot.com http://freefreedownloadsoftwares.blogspot.com
VIEWS ON THIS POST

37

Posted on:

Wednesday 7th November 2012
View Replies!

How to view the implementation of STRING class

In string.h,only the declarations of the functions can be viewed,where can I find the source code of the implementations of the String Class.
VIEWS ON THIS POST

172

Posted on:

Wednesday 7th November 2012
View Replies!

Request to review code for best practices

A while back I posted a Fibonacci sequence calculator on this group, and asked people to critique it. I received many helpful comments, and made the program a lot better. Now, I've converted it to use GMP so there's a bit of pointer work and dynamic memory allocation going on. Can I, once again, have comments on whether or not the code does "good practices", and where it could be better
VIEWS ON THIS POST

148

Posted on:

Wednesday 7th November 2012
View Replies!

small design issues with creating views (portions) of a class

hi, here's a piece of code and questions below. any suggestion would be appreciated. class Write_view{ public: Write_view(Obj&,unsigned int index){/*.../*}; void fun(...){/*...*/};//writes in portion index of Obj }; class Obj{ public: Write_view view(unsigned int index){ return Write_view(*this,index) }; friend class Write_view; private: //some data }; a) should i be worried that Obj may be deleted before Write_view perhaps i could make the constructor of Obj private and use a friend helper function to call the constructor and return a shared_ptr. is that an overkill or it sounds fine b) i'm unhappy with view(index) returning an object because i only need the same object no matter how often i call it on the same object. how about this shared_ptr view(unsigned int index){ if(count[index]==0){ views[index]=shared_ptr(new Write_view(*this,index)); }; return views[index];// map views }; or this Write_view& view(unsigned int index){ return *shared_ptr(new Write_view(*this,index)); }; c) is there a better way altogether
VIEWS ON THIS POST

167

Posted on:

Wednesday 7th November 2012
View Replies!

A threadpool design fror review

This is for anyone who likes to design in C++. I have put up a Threadpool design at code project at http://69.10.233.10/KB/threads/PluginThreadPool.aspx .. Whoever has the interest can review this and learn from this. { The numeric URL above might ...
VIEWS ON THIS POST

64

Posted on:

Sunday 25th November 2012
View Replies!

C++ interview questions

After1 month from now, I will start giving job interviews. Searchign at Google led me to several common questions asked in interviewers looking for C++ based programmers. I have titled it "C++ interview questions - 1 (technical)" as, after sometime, ...
VIEWS ON THIS POST

71

Posted on:

Sunday 25th November 2012
View Replies!