The free() statements in the following example code engages in undefined behavior because the pointers received from malloc() have been altered. Segment faults,
| This is the talk page for discussing improvements to the Automatic vectorization article. This is not a forum for general discussion of the subject of the article. |
Article policies
|
| Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
| This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||
| ||||||||||||||||||
The free() statements in the following example code engages in undefined behavior because the pointers received from malloc() have been altered. Segment faults, or other abnormal terminations, would be expected.
int *a = malloc(128*sizeof(int)); int *b = malloc(128*sizeof(int)); // initialize b for (i = 0; i<128; i++, a++, b++) *a = *b + 5; // ... // ... // ... free(b); free(a);
A very simple fix changes the following two lines:
for (i = 0; i<128; i++ )
a[i] = b[i] + 5;
YetAnotherAuthor (talk) 23:44, 28 February 2016 (UTC)
Hello fellow Wikipedians,
I have just modified one external link on Automatic vectorization. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at {{Sourcecheck}}).
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).
Cheers.—InternetArchiveBot (Report bug) 06:33, 22 October 2016 (UTC)
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.