Skip to content

Instantly share code, notes, and snippets.

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.

@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active August 29, 2015 14:07
gcc/clang pointer equality bug demo

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,

@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active August 29, 2015 14:06
g++ bug demo
@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active August 29, 2015 14:03
clang _Generic bug
#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;
/*
* 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);
@Keith-S-Thompson
Keith-S-Thompson / README.md
Created February 15, 2014 00:43
Markdown sandbox

One hash

Two hashes

Three hashes

Four hashes

Five hashes
@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active March 22, 2023 03:06
Discussion of korn.c, 1987 IOCCC entry, mentioned in http://stackoverflow.com/a/19214007/827263

korn.c is the "Best One Liner" winner of the 1987 International Obfuscated C Code Contest, by David Korn (yes, the author of the Korn Shell).

korn.hint, as the name implies, offers some hints.

A commenter on Stack Overflow asked for some clarification. I didn't want to post spoilers on the site, so I'm posting them here instead. If you haven't already (and if you're familiar with the rules of C) I encourage you to study the program for a while first.

=====

Here's the code:

/*
* Test program based on code in the Wikipedia POSIX Threads
* article, https://en.wikipedia.org/wiki/POSIX_Threads.
*
* Demo for http://stackoverflow.com/q/19128948/827263
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>