Skip to content

Instantly share code, notes, and snippets.

int SearchAndIncrement(int x, list** head) {
int contapos = 0;
list* i;
// Let's find the element with the matching key
for (i = *head; i != NULL; i = i->next, contapos++)
if (i->key == x)
break;
// If we did not find the node, return -1 to denote failure.
[2:25pm][wlynch@watermelon /tmp] cat foo.c
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct _list {
int key;
int freq;
struct _list *next;
struct _list *prev;
struct JumpTableEntry {
int & usage;
};
int main() {
int x;
JumpTableEntry e = {x};
}
class Collider {
};
class SpecificCollider : public Collider {
};
struct ColliderDetails {
std::unique_ptr<Collider> collider;
ColliderDetails(ColliderDetails&& o) noexcept
; Function Attrs: nounwind ssp uwtable
define i32 @main() #0 {
%1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i64 0, i64 0), double 3.500000e+00) #3
ret i32 0
}
#include <map>
int main() {
std::map<int, int> m;
m[0] = m.size();
// m[0] can legally be either 0 or 1.
}
#include <map>
#include <boost/filesystem.hpp>
int main() {
std::map<float, std::vector<boost::filesystem::path>> labeledImages;
labeledImages[3] = { boost::filesystem::path("/"), };
labeledImages[7] = { boost::filesystem::path("/"), boost::filesystem::path("/tmp"), };
for (auto& labeledPathsPair : labeledImages) {
# Makefile!
SOURCES := $(sort $(wildcard src/*.cpp src/*.cu src/*.cc src/*.c))
OBJECTS := $(sort $(patsubst src/%, obj/%.o, $(SOURCES)))
DEPENDS := $(sort $(patsubst src/%, obj/%.d, $(SOURCES)))
CFLAGS +=
CUFLAGS +=
CPPFLAGS +=
LDFLAGS +=
#include <string>
#include <boost/spirit/home/qi.hpp>
#include <boost/spirit/home/lex.hpp>
#include <boost/spirit/home/lex/lexer/lexertl/lexer.hpp>
struct dtype {
dtype() {}
dtype(std::string const & value) {}
};
[11:59pm][wlynch@fallston ~/test] ipython
Python 2.4.3 (#1, Sep 21 2011, 19:55:41)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.