Skip to content

Instantly share code, notes, and snippets.

View ashgti's full-sized avatar

John Harrison ashgti

View GitHub Profile
@ashgti
ashgti / wtf.cc
Last active December 12, 2015 00:58
Don't do this ever please. If you have to, please comment it.
#include <stdio.h>
struct foo {
struct dummy {
int i;
};
typedef int dummy::*_bool;
foo(int f) : f_(f) {}
int f_;
Index: lib/profile/GCDAProfiling.c
===================================================================
--- lib/profile/GCDAProfiling.c (revision 173961)
+++ lib/profile/GCDAProfiling.c (working copy)
@@ -269,6 +269,9 @@
for (i = 0; i < num_counters; ++i)
fprintf(stderr, "llvmgcda: %llu\n", (unsigned long long)counters[i]);
#endif
+
+ for (i = 0; i < num_counters; ++i)
#include <iostream>
using namespace std;
class a {
public:
struct dummy { int i; double j; };
typedef int dummy::* _bool;
};
typedef int bar;
#include <stdio.h>
struct FOO {
class_loader::class_loader_private::registerPlugin<A,B> &bar;
};
static FOO foo(baz);
int main(void) {
foo2.bar = 3;
a = foo()
a.bar = 123 # default
with a:
a.bar = 13213
a.do_stuff()
with a:
a.bar = 5432
a.do_stuff()
cc1plus: warning: -Wuninitialized is not supported without -O
In file included from /Users/harjohn/Projects/serial/src/serial.cc:4:
/Users/harjohn/Projects/serial/include/serial/serial.h:610: warning: ‘class serial::SerialExecption’ has pointer data members
/Users/harjohn/Projects/serial/include/serial/serial.h:610: warning: but does not override ‘serial::SerialExecption(const serial::SerialExecption&)’
/Users/harjohn/Projects/serial/include/serial/serial.h:610: warning: or ‘operator=(const serial::SerialExecption&)’
/Users/harjohn/Projects/serial/include/serial/serial.h:624: warning: ‘class serial::IOException’ has pointer data members
/Users/harjohn/Projects/serial/include/serial/serial.h:624: warning: but does not override ‘serial::IOException(const serial::IOException&)’
/Users/harjohn/Projects/serial/include/serial/serial.h:624: warning: or ‘operator=(const serial::IOException&)’
/Users/harjohn/Projects/serial/include/serial/serial.h:651: warning: ‘class serial::PortNotOpenedException’ has pointe
@ashgti
ashgti / Output
Created April 4, 2012 17:02
C++ Templates with default params
Type is... int
Type is... char
Type is... float
Type is... double
Type is... long
Type is... short
Type is... int
Type is... double
@ashgti
ashgti / Error Msgs
Created March 17, 2012 02:49
Rustc build failure
Stack dump:
0. Running pass 'Function Pass Manager' on module 'core.rc'.
1. Running pass 'Greedy Register Allocator' on function '@_ZN7unicode16derived_property10Alphabetic17_fa1eb4cef144b687E'
/bin/sh: line 1: 78747 Illegal instruction: 4 x86_64-apple-darwin/stage1/bin/rustc -O --target=x86_64-apple-darwin --enforce-mut-vars -o x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libcore.dylib src/libcore/core.rc
make: *** [x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libcore.dylib] Error 132
$ avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:UNO-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
iface foo<A> {
fn bar(a: A, b: A);
}
impl of foo<int> for int {
fn bar(a: int) {
// bad.
}
}