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.
using namespace std;
#include<iostream>
#include<cmath>
#include<iomanip>
void readit(int);
void calcit(int, float, int, int);
int writeit(float, float, float, float, int, int);
int GetNumber(string Give) {
#include <utility>
int main() {
std::pair<int, volatile long> x(3, 4);
}
class X {
public:
X() {
this->val = rand();
}
int val;
};
static X global_value;
class X {
public:
X() {
this->val = rand();
}
int val;
};
static X global_value;
@sharth
sharth / gist:2997272
Created June 26, 2012 17:31
Valgrind fails to build
[12:26pm][wlynch@watermelon ~] brew install valgrind
==> Downloading http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/valgrind-3.7.0.tar.bz2
==> ./configure --prefix=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0 --mandir=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0/share/man --enable-only64bit --build=amd64-darwin
==> make
echo "# This is a generated file, composed of the following suppression rules:" > default.supp
echo "# " exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp >> default.supp
cat exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp >> default.supp
make all-recursive
Making all in include
[4:16am][wlynch@fallston ~/test] cat package/module.py
#!/usr/bin/env python
print "Loading module.py"
from package import signal
[4:18am][wlynch@fallston ~/test] python package/module.py
Loading module.py
Traceback (most recent call last):
File "package/module.py", line 3, in ?
from package import signal
ImportError: No module named package
[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.
#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) {}
};
# 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 +=