Boost logo

Boost :

Subject: Re: [boost] [array] compile-time checked access
From: Jens Auer (jensa_at_[hidden])
Date: 2012-11-05 09:08:33


Hi,

I cannot see any code but only newlines in your post, so I will not respond to the example. The sort of analysis you are looking for is done by static analysis tools (as far as possible, there are limitations). A classic one would be lint, but I don't know if they catch such errors. The documentation says that they do value tracking and some form of abstract interpretation. You should be able to find a lot of (commercial) tools with google if you search for static analysis c++. Klocwork and QA Systems are well-known vendors I know about.

The MS compiler also has some static analysis facilities and there exists a free static analyzer based on clang: http://clang-analyzer.llvm.org/.

Best regards,
  Jens

-----Ursprüngliche Nachricht-----
Von: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] Im Auftrag von Tobias Loew
Gesendet: Montag, 5. November 2012 09:51
An: boost_at_[hidden]
Betreff: [boost] [array] compile-time checked access

Hi,

I was just rewriting some old code with hard coded indices for array access and though that compile-time checked access to array elements would be a nice thing.
Maybe there are smart compilers out there that emit warnings or errors for a hard coded out-of-bounds access, but my compiler does not.

So, code like

compiles without warnings or erros.
Now, adding the following functions to array

would make it possible to write

which results in the expected error messages.

Tobias

--
View this message in context: http://boost.2283326.n4.nabble.com/array-compile-time-checked-access-tp4638135.html
Sent from the Boost - Dev mailing list archive at Nabble.com.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk