Click here to Skip to main content
15,890,690 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to handle runtime access violation exception Pin
leon de boer4-Jul-16 20:46
leon de boer4-Jul-16 20:46 
QuestionProblem with C++ arrays. Pin
Ratul Thakur30-Jun-16 3:15
Ratul Thakur30-Jun-16 3:15 
AnswerRe: Problem with C++ arrays. Pin
jeron130-Jun-16 4:17
jeron130-Jun-16 4:17 
AnswerRe: Problem with C++ arrays. Pin
k505430-Jun-16 4:29
mvek505430-Jun-16 4:29 
GeneralRe: Problem with C++ arrays. Pin
Ratul Thakur30-Jun-16 5:47
Ratul Thakur30-Jun-16 5:47 
GeneralRe: Problem with C++ arrays. Pin
k505430-Jun-16 6:06
mvek505430-Jun-16 6:06 
AnswerRe: Problem with C++ arrays. Pin
Patrice T2-Jul-16 13:14
mvePatrice T2-Jul-16 13:14 
GeneralRe: Problem with C++ arrays. Pin
leon de boer2-Jul-16 22:31
leon de boer2-Jul-16 22:31 
Actually the behaviour has nothing to do with speed, its a legacy of dereferenced pointers in C

p[i] is EXACTLY the same as writing *(p+i), most novice programmers will recognize the first form but not the second. The two codes are literally identical and will almost always produce the same code. The second however makes it clear that applying bound checking as a generic behaviour would break all dereferenced pointers. Some C compilers recognize the first form as a special case and will do bound checking and give a warning, but even they will not detect a bound error if the second form is used because p+i is just a pointer with an offset. That may well be, and often is intended behaviour.

So array bounds has always been and will always remain the responsibility of the C programmer. A pointer can exist to a memory that is non existent, invalid or has been previously released anyhow, so the array bound situation is no more dangerous than any of those all of which are the C programmers responsibility.
In vino veritas

AnswerRe: Problem with C++ arrays. Pin
Henry Faure4-Jul-16 9:26
Henry Faure4-Jul-16 9:26 
GeneralRe: Problem with C++ arrays. Pin
jeron15-Jul-16 5:29
jeron15-Jul-16 5:29 
GeneralRe: Problem with C++ arrays. Pin
Super Lloyd6-Jul-16 17:34
Super Lloyd6-Jul-16 17:34 
GeneralRe: Problem with C++ arrays. Pin
jeron17-Jul-16 6:07
jeron17-Jul-16 6:07 
GeneralRe: Problem with C++ arrays. Pin
Super Lloyd7-Jul-16 14:38
Super Lloyd7-Jul-16 14:38 
QuestionCFileStatus m_mtime problems Pin
Member 1253112930-Jun-16 2:09
Member 1253112930-Jun-16 2:09 
AnswerRe: CFileStatus m_mtime problems Pin
Eddy Vluggen30-Jun-16 2:29
professionalEddy Vluggen30-Jun-16 2:29 
GeneralRe: CFileStatus m_mtime problems Pin
Member 1253112930-Jun-16 2:33
Member 1253112930-Jun-16 2:33 
GeneralRe: CFileStatus m_mtime problems Pin
Eddy Vluggen30-Jun-16 2:54
professionalEddy Vluggen30-Jun-16 2:54 
GeneralRe: CFileStatus m_mtime problems Pin
Member 1253112930-Jun-16 3:14
Member 1253112930-Jun-16 3:14 
AnswerRe: CFileStatus m_mtime problems Pin
Richard MacCutchan30-Jun-16 2:54
mveRichard MacCutchan30-Jun-16 2:54 
AnswerRe: CFileStatus m_mtime problems Pin
Jochen Arndt30-Jun-16 3:06
professionalJochen Arndt30-Jun-16 3:06 
AnswerRe: CFileStatus m_mtime problems Pin
Member 1253112930-Jun-16 21:51
Member 1253112930-Jun-16 21:51 
QuestionCompile dll in Ubuntu to include in Windows 7 (32 bit) program Pin
Member 1224497229-Jun-16 6:41
Member 1224497229-Jun-16 6:41 
AnswerRe: Compile dll in Ubuntu to include in Windows 7 (32 bit) program Pin
Jochen Arndt29-Jun-16 7:08
professionalJochen Arndt29-Jun-16 7:08 
AnswerRe: Compile dll in Ubuntu to include in Windows 7 (32 bit) program Pin
leon de boer29-Jun-16 7:22
leon de boer29-Jun-16 7:22 
Questionstd::string declaration in header file error Pin
Member 1224497229-Jun-16 3:26
Member 1224497229-Jun-16 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.