Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Statically detectable features of C++

Posted on 2004-05-01
8
Medium Priority
?
203 Views
Last Modified: 2010-04-01
Hi all,

I am writing a programming standard for a project i am just about to start. I was just after all the possible statically detectable features of C++ to be considered when writing programming standards to check if I have included all important ones. Thanx,
        Andy
0
Comment
Question by:acrxx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 10973042
>> statically detectable features of C++

I don't know what do you want to say with that expression.

The problem is that the Compiler checks C++ syntax (features). All restrictions beyond the fact that a C++ code has to be compilable are subject of your individual decision. So, you may postulate a strict hungarian name convention or insist on compliance to (new) C++ standard (both i would recommend). However, these issues are _NOT_  'statically detectable' at least not with easy means.

Regards, Alex
0
 
LVL 3

Expert Comment

by:CoolBreeze
ID: 10974190
what is meant by
>> statically detectable features of C++
?

if you want to do static checking, check out this page:
http://amks0203.turkuamk.fi/msuni/Testing/Teststatic.pdf

but otherwise, it is like what itsmeandnobodyelse said, pretty much is a subject of your individual decision.
0
 

Author Comment

by:acrxx
ID: 10975775
statically detectable concerns errors that can be detected without running the code
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:Axter
ID: 10975788
One way to add extra static checking is to increase the compiler warning options to the highest setting, and to also set the option to have your compiler treat warnings as errors.
Most compilers support these two features, and code is more portable when compiled with these options.
0
 

Author Comment

by:acrxx
ID: 10980499
Thank you for your suggestions, butI am not talking about how to detect them, I am looking for different examples of such errors
0
 
LVL 30

Expert Comment

by:Axter
ID: 10980549
>>Thank you for your suggestions, butI am not talking about how to detect them, I am looking for different examples of such errors

Why would this be important if the compiler is going to catch it for you?
0
 
LVL 3

Accepted Solution

by:
CoolBreeze earned 1000 total points
ID: 10983076
as acrxx mentioned, statically detectable concerns errors that can be detected without running the code.
this includes logic error, includes checking for the life-time, scope, type of variables, branch flow etc.
(these are talked about in the link provided earlier)

but as what Axter said, what is important is not the errors, it is about catching them. So what we should be interested in is the various ways of catching them, compiler being one of them.

why do I say we should concentrate more on the methodology of checking instead? because a single problem can leads to many different errors. There are just too many errors to consider. Consider all the various different syntax errors, that is many. For example using an inappropriate type for variables might lead to corrupted data, or might lead to memory leak, etc.

therefore if one concentrates on getting all the different errors, it is hard to succeed. Instead, in my humble opinion, one should look at something and think : this is correct, but what can I put in the standard such that other people will not deviate from this approach which I know is right.

or if I want a more flexible standard, I would think : this is one way of doing it and I know it is correct, can't find any bugs about it. But what if they did it another way? Is there any way for me to test whether that code is just as good?
0
 
LVL 30

Expert Comment

by:Axter
ID: 10995679
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question