Top Stories

Lava Kafle


C++ Programming: Static Code Analysis and the New Language Standard C++0x – CodeGuru

This function cannot work on a 64-bit system with large arrays. If the 
variable arraySize has a value more than UINT_MAX, the condition 
"i < arraySize" will never be fulfilled and an eternal loop will 

occur.bool IsPresent(char *array,
               size_t arraySize,
               char key)
  for (unsigned i = 0; i < arraySize; i++) 
    if (array[i] == key)
      return true;
  return false;

warning C4267: 'initializing' : 
conversion from 'size_t' to 'unsigned int', possible loss of data
void f(const vector<int>& a,
       vector<float>& b)
  typedef decltype(a[0]*b[0]) Tmp;
  for (int i=0; i<b.size(); ++i)
    Tmp* p = new Tmp(a[i]*b[i]);
    // ...

This code has a 64-bit error: the function behaves correctly when compiling the Win32 version and fails when the code is built in the Win64 mode. The error is in using the type unsigned for the variable “n”, although the type string::size_type must be used which is returned by the function find(). In the 32-bit program, the types string::size_type and unsigned coincide and we get correct results. In the 64-bit program, string::size_type and unsigned do not coincide any more. When the substring is not found, the function find() returns the value string::npos that equals 0xFFFFFFFFFFFFFFFFui64. This value is cut to the value 0xFFFFFFFFu and placed into a 32-bit variable. As a result, the condition 0xFFFFFFFFu != 0xFFFFFFFFFFFFFFFFui64 is true and we have the situation when the function Find_Incorrect always returns true.

C++ Programming: Static Code Analysis and the New Language Standard C++0x – CodeGuru.

8 thoughts on “C++ Programming: Static Code Analysis and the New Language Standard C++0x – CodeGuru

  1. Hello there,

    My name is Aly and I would like to know if you would have any interest to have your website here at promoted as a resource on our blog ?

    We are in the midst of updating our broken link resources to include current and up to date resources for our readers. Our resource links are manually approved allowing us to mark a link as a do-follow link as well
    If you may be interested please in being included as a resource on our blog, please let me know.


  2. Kurye olarak hizmet veren kişiler, bulundukları lokasyondaki her adrese en kısa sürede ulaşma yolunu bilirler. Üstelik verilen bu görevi hava, trafik ve buna benzer diğer olumsuz şartlardan etkilenmeden yerine getirirler. Yani iş hayatı başta olmak üzere hayatın hemen her alanında önemli görevleri üstlenebilir ve başarıyla yerine getirebilirler. Özellikle büyük şehirlerdeki trafik kaosu ve adres konusundaki karmaşa göze alınırsa, kurye hizmetlerinden faydalanmanın bazı durumlarda zorunlu hale geleceği anlaşılabilir. Örneğin İstanbul’un bir noktasından diğer bir noktasına acil şekilde önemli bir evrak ulaştırmak gerektiğinde ya da hastanızın ihtiyacı olan ilacı acil ve güvenli bir şekilde ulaştırmak gerektiğinde, İstanbul moto kurye hizmetimizden faydalanarak sorununuza çözüm üretebilirsiniz.

  3. I simply want to say I’m very new to blogging and site-building and truly loved you’re web page. More than likely I’m planning to bookmark your site . You surely come with remarkable article content. With thanks for revealing your webpage.

  4. GCC provides experimental support for the upcoming ISO C++ standard, C++0x. This support can be enabled with the -std=c++0x or -std=gnu++0x compiler options; the former disables GNU extensions.
    GCC’s C++0x mode tracks the C++0x working paper drafts produced by the ISO C++ committee, available on the ISO C++ committee’s web site
    Since this standard is still being extended and modified, the feature set provided by the experimental C++0x mode may vary greatly from one GCC version to another. No attempts will be made to preserve backward compatibility with C++0x features whose semantics have changed during the course of C++0x standardization.

  5. Bjarne Stroustrup, inventor of the cplus cplusplus C++ programming language, is a computer scientist and the College of Engineering Chair Professor of Computer Science at Texas A&M University. He has always been highly involved in the standardization of C++. Since 2004, Bjarne and the standards committee have been busy hammering out the details of a new standard, temporarily titled C++0x. Bjarne was gracious enough to take time out of his busy schedule to speak with DevX C++ Pro, Danny Kalev, about new C++0x features and the state of the C++ language.

  6. In recognition of his work in the .NET area, he was awarded the Microsoft Most Valued Professional Award from 2002 through 2007.
    The move of Visual C++ onto the MSBuild platform brings C++ inline with Microsoft’s other compiler offerings that all use this format. Visual C++ 2010 is deeply integrated into MSBuild, with all elements of the build process fully visible and accessible in the new VCXPROJ project file format.

    MSBuild is a documented, powerful, and extensible build engine that far exceeds the capabilities of the previous Visual C++ build engine. MSBuild takes Items and associated Properties as inputs into a Task, and Tasks are grouped together into Targets to form a high-level build activity. MSBuild will be welcomed by C++ developers who miss the power and expressiveness of MAK files, and for developers who have yet to explore the world of build customization and extension, the introduction of MSBuild as the project file format for Visual C++ 2010 represents the best time to get started.
    Nick Wienholt is an independent Windows and .NET consultant based in Sydney. He is the author of Maximizing .NET Performance and co-author of A Programmers Introduction to C# 2.0 from Apress, and specialises in system-level software architecture and development, with a particular focus of performance, security, interoperability, and debugging.

Leave a Reply

Your email address will not be published. Required fields are marked *