Description:
Discussion about C.
|
|
|
NetBSD Crypto Bug: sizeof v. sizeof()
|
| |
This bad code[1] compromised[2] NetBSD's CPRNG implementation:
rnd_extract_data(key + r, sizeof(key - r), RND_EXTRACT_ANY);
One might argue this bug stemmed from using the sizeof() idiom instead of
stylistically treating sizeof as a regular operator.
1: [link]... more »
|
|
K&N Exercise Problem
|
| |
I've gotten started with the famous book. As of now, I'm stuck on an exercise in Chapter 4. I would really love if someone could provide some hints as to what I'm doing wrong and how can I improve the solution. The problem wants me to add some improvements (add variables) to the Polish calculator.... more »
|
|
strange behaviour of realloc()
|
| |
Hello,
As far as I understand realloc() should not modify the old array, however this does not seem to happen:
...
int main(void)
{
int *p, i;
size_t size=0;
printf("Size of the vector: ");
scanf("%d", &size);
p = (int *)malloc(size*sizeof(int));
if (p==NULL)
{... more »
|
|
three problems of C... a little bit long but not complex.......
|
| |
what's the composite type of two sturct/union?
such as struct f bar;
struct f
{
int member;
...
it will produce a composite type? what's that?
______________________________ ________________________
C11 6.5p7 says that An object shall have its stored value accessed only by an lvalue expression that has one of... more »
|
|
Splint warnings about dependent storage returned as implicitly only.
|
| |
I'm trying get my code to pass splint and I'm having difficulty understanding the warnings. I've read up on Splint's memory model ([link]), but my use of memory is very, very different.
I'm doing sub-allocation within big malloc'ed regions, with a custom garbage-collector. So I want just the minimum annotations to keep splint happy.... more »
|
|
|