/* | |
* In response to http://stackoverflow.com/a/22918463/827263 | |
* "In C you can't declare variables/functions (in same scope) with the same name more than once." | |
*/ | |
#include <stdio.h> | |
void yes_you_can(void); | |
void yes_you_can(void); | |
void yes_you_can(void); |
#include <stdio.h> | |
#include <stdint.h> | |
int main(void) { | |
int64_t u = 0; | |
int i; | |
for(i=0;i<44;i++) | |
u |= (uint64_t)1 << i; |
Demo for clang bug (demonstrated with version 3.4)
Based on this question on Stack Overflow.
===
It turns out that this isn't a bug; see Jens Gustedt's answer to the question.
This small C++ program demonstrates an apparent optimization bug in g++.
It's based on a question on Stack Overflow: Does C++ allow an optimizing compiler to ignore side effects on the for-condition?. (I'm reasonably sure the answer in this case is no.)
I believe I've found a bug in the implementation of the "==" operator for pointers in both gcc and clang.
pointer_equality_bug.c
is a demonstration of the bug.
Quoting N1570 6.5.9p6:
Two pointers compare equal if and only if both are null pointers,
This is a simplified test case for this question on Stack Overflow.
This is a CVS demo script for this question posted by Paul Bunch on Stack Overflow.
The cvs annotate
command prints a message on standard error of the form:
Annotations for hello.txt
***************
The questioner is trying to redirect that message when invoking cvs annotate
from a Perl script. I have so far been unable to reproduce the problem. I ask Paul Bunch to try running this script on his own system.
This is foo.txt. | |
I'm just trying out this "gist" thing. | |
Hey, and I can edit it! |
/* | |
* Reference: http://stackoverflow.com/questions/9169453/gcc-4-4-3-offsetof-constant-expression-bug-how-should-i-work-around-this | |
* Should compile and execute without error or warning with: | |
* gcc c.c -pedantic -std=c89 -o c && ./c | |
* or | |
* gcc c.c -pedantic -std=c99 -o c && ./c | |
*/ | |
#include <stddef.h> | |
#include <stdlib.h> |