background preloader

Programming

Facebook Twitter

OpenGL

Lisp. Selenium web application testing system. Eli Bendersky’s website » Blog Archive » Pointers to arrays in C. Pointers are a great source of confusion in C – newbies have a hard time grasping them. But coupled with arrays, some of the semantics of pointers are complex enough to confound even more seasoned programmers. Consider this code: void test(int** p) { } int main() { int arr[] = {30, 450, 14, 5}; test(&arr); return 0; } Take a moment to ponder – would you expect this code to compile cleanly?

Gcc isn’t very happy about it, and issues a warning: passing arg 1 of test from incompatible pointer type. C++ has stricter type checking, so let’s try running the same code through g++. As expected, we get an error: cannot convert int (*)[4] to int** for argument 1 to void test(int**) So what’s the problem here? Void test(int* p) { } int main() { int arr[] = {30, 450, 14, 5}; test(arr); return 0; } But this one works specifically because the C compilers should follow the C standard, which mandates that arrays "decay" into pointers when used as lvalues. But the first code snippet is different. A Curious Course on Coroutines and Concurrency. Copyright (C) 2009, All Rights ReservedDavid B Presented at PyCon 2009, March 25, 2009. (7/19/2009) The Python Essential Reference, 4th Edition is now available. If you like this tutorial, you'll like this edition--there is extended coverage of generators, coroutines, and other advanced Python features.

Introduction This tutorial is a practical exploration of using Python coroutines (extended generators) for solving problems in data processing, event handling, and concurrent programming. Presentation Slides (PDF) Note: This tutorial might be viewed as a sequel to the tutorial Generator Tricks for System Programmers I presented at PyCon'08 in Chicago. Requirements and Support Data Files This tutorial requires the use of Python 2.5 or newer. The following file contains some supporting data files that are used by the various code samples. Coroutines.zip This download also includes a PDF of the lecture slides. Code Samples Here are various code samples from the course. List of algorithms.

What Every Computer Scientist Should Know About Floating-Point A. This appendix is an edited reprint of the paper , by David Goldberg, published in the March, 1991 issue of Computing Surveys. Copyright 1991, Association for Computing Machinery, Inc., reprinted by permission. Abstract Floating-point arithmetic is considered an esoteric subject by many people. This is rather surprising because floating-point is ubiquitous in computer systems.

Almost every language has a floating-point datatype; computers from PCs to supercomputers have floating-point accelerators; most compilers will be called upon to compile floating-point algorithms from time to time; and virtually every operating system must respond to floating-point exceptions such as overflow. This paper presents a tutorial on those aspects of floating-point that have a direct impact on designers of computer systems. D.2.1 [Software Engineering]: Requirements/Specifications -- ; D.3.4 Programming Languages]: Formal Definitions and Theory -- ; D.4.1 Operating Systems]: Process Management -- . Proof. Wotsit.org. Simulate Form Post Using Perl. Rosetta Code. Structure and Interpretation of Computer Programs.