background preloader

Top 10 Ways to be Screwed by "C"

Top 10 Ways to be Screwed by "C"
To get on this list, a bug has to be able to cause at least half a day of futile head scratching, and has to be aggravated by the poor design of the "C" language. In the interests of equal time, and to see how the world has progressed in the 20-odd years since "C" escaped from its spawning ground, see my Top 10 Ways to be Screwed by the Java programming language, and for more general ways to waste a lot of time due to bad software, try my Adventures in Hell page. A better language would allow fallible programmers to be more productive. Infallible programmers, of the type unix' and "C" designers anticipated, need read no further. Non-terminated comment, "accidentally" terminated by some subsequent comment, with the code in between swallowed. a=b; /* this is a bug c=d; /* c=d will never happen */ Accidental assignment/Accidental Booleans if(a=b) c; /* a always equals b, but c will be executed if b! Closely related to this lack of rigor in booleans, consider this construction: Or consider this:

Conway's Game of Life "Conway game" redirects here. For Conway's surreal number game theory, see surreal number. The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.[1] The "game" is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. Rules[edit] The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Any live cell with fewer than two live neighbours dies, as if caused by under-population.Any live cell with two or three live neighbours lives on to the next generation.Any live cell with more than three live neighbours dies, as if by overcrowding.Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. The initial pattern constitutes the seed of the system. Origins[edit] Examples of patterns[edit] Gosper glider gun Self-replication[edit]

Programming, Motherfucker - Do you speak it? comp.lang.c FAQ Script Junkie | Building Cross-Platform Apps Using jQuery Mobile jQuery Mobile introduces a cross-platform and cross-device framework for developing mobile applications. It supports a wide variety of mobile browsers and delivers a unified user interface to the devices. It has simplified working with mobile browsers by abstracting away inconsistences between the vendors. Just as jQuery changed the way we wrote JavaScript , jQuery Mobile will change the way we build mobile web applications. I recently used jQuery Mobile to build an application and was stunned at how smoothly the development process went. As a web developer, jQuery Mobile is instantly rewarding because there isn’t much of a learning curve. Page Structure and Components We are going to build a to-do application. For this application there is only going to be one physical page, index.html. Aside from referencing the latest version of jQuery, we also reference jquery.mobile-1.0a4.1.min.css and jquery.mobile-1.0a4.1.min.js via CDN. Let’s fill out our create page. Conclusion About the Author

The Basics of C Programming" The C programming language is a popular and widely used programming language for creating computer programs. Programmers around the world embrace C because it gives maximum control and efficiency to the programmer. If you are a programmer, or if you are interested in becoming a programmer, there are a couple of benefits you gain from learning C: You will be able to read and write code for a large number of platforms -- everything from microcontrollers to the most advanced scientific systems can be written in C, and many modern operating systems are written in C.The jump to the object oriented C++ language becomes much easier. C++ is an extension of C, and it is nearly impossible to learn C++ without learning C first. In this article, we will walk through the entire language and show you how to become a C programmer, starting at the beginning.

C Tips and Tricks Wiki Java Tutorial 7 - String Manipulation String manipulation forms the basis of many algorithms and utilities such as text analysis, input validation, and file conversion. This tutorial explores some of the needed basics. Unless otherwise noted, the following classes are contained in the java.lang library. NOTE: For the following parameters the prefix g indicates string, i indicates integer and c indicates character types. The String Class String class objects work with complete strings instead of treating them as character arrays as some languages do. Accessor methods: length(), charAt(i), getBytes(), getChars(istart,iend,gtarget[],itargstart), split(string,delim), toCharArray(), valueOf(g,iradix), substring(iStart [,iEndIndex)]) [returns up to but not including iEndIndex] Modifier methods: concat(g), replace(cWhich, cReplacement), toLowerCase(), toUpperCase(), trim().Note: The method format(gSyn,g) uses c-like printf syntax for fixed fields if required in reports. String class objects are immutable (ie. read only). Projects

Algorithm Design Optimizing C and C++ Code Embedded software often runs on processors with limited computation power, thus optimizing the code becomes a necessity. In this article we will explore the following optimization techniques for C and C++ code developed for Real-time and Embedded Systems. Many techniques discussed here have roots in the material we covered in the articles dealing with C to Assembly translation. A good understanding of the following articles will help: Premature optimization is the root of all evil Donald Knuth wrote, "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. In general, correctness and readability considerations trump code performance issues for most of your code. Adjust structure sizes to power of two Place case labels in narrow range Place frequent case labels first Splitting a switch statement

CoRR - Computing Research Repository Welcome to the Computing Research Repository Welcome to the Computing Research Repository (CoRR). CoRR allows researchers to search, browse and download papers through its online repository. Please feel free to explore the site and features. First time user? View Listings Computing Research Repository (CoRR): new, recent, abs, find By Category: The First Few Milliseconds of an HTTPS Connection Convinced from spending hours reading rave reviews, Bob eagerly clicked “Proceed to Checkout” for his gallon of Tuscan Whole Milk and… Whoa! What just happened? In the 220 milliseconds that flew by, a lot of interesting stuff happened to make Firefox change the address bar color and put a lock in the lower right corner. By agreement of RFC 2818, Firefox knew that “https” meant it should connect to port 443 at Amazon.com: Most people associate HTTPS with SSL (Secure Sockets Layer) which was created by Netscape in the mid 90’s. Client Hello TLS wraps all traffic in “records” of different types. The next two bytes are 0x0301 which indicate that this is a version 3.1 record which shows that TLS 1.0 is essentially SSL 3.1. The handshake record is broken out into several messages. Random: There are four bytes representing the current Coordinated Universal Time (UTC) in the Unix epoch format, which is the number of seconds since January 1, 1970. Server Hello Checking out the Certificate

Related: