Milinda Pathirage’s Blog

Let the code talk for yourself!

Entries from May 2008

Difference between static functions and static variables in C

May 28th, 2008 · No Comments · c programming

Static Functions

Static functions are functions that are only visible to functions in the same file and they are not callable from outside. Static functions are used when we only need to call them within the single source file they are defined in. This make static functions are usable when we need to hide internal details [...]

[Read more →]

Tags:

memcpy vs memmove

May 23rd, 2008 · No Comments · c programming

These are some ideas from people who replied to this discussion.

Rishi:
Its safer to use memmove if you are not sure about the overlapping of source buffer and destination buffer. This make memmove little bit slower than memcpy which blindly copies the src into dest and will probably get nuked if they overlap. Its smarter cousin [...]

[Read more →]

Tags:

GCC 4.3 changes caused build break when use -Wall and -Werror together

May 23rd, 2008 · 1 Comment · c programming, linux tips

As they have mentioned in this document, there can be errors in code that work well with previous versions of GCC. They have mentioned that, new warnings may exist for previously warning-free code that uses -Wuninitialized, -Wstrict-aliasing,-Wunused-function, -Wunused-variable (-Wall subsumes many of these warning flags). And when we use -Wall in conjuction with -Werror it [...]

[Read more →]

Tags:

Beautiful Code - Gift from Google

May 22nd, 2008 · 1 Comment · Uncategorized

Today I received Beautiful Code book published by O’Reilly as surprise gift for Google Summer of Code 2008. I didn’t have much time to read through it, but I read the Foreword by one of it’s editors Greg Wilson.

Following paragraph from the foreword amazed me because it’s common problem with most of us who involved [...]

[Read more →]

Tags:

Fixing “macro `AM_GCONF_SOURCE_2′ not found in library” in Ubuntu

May 22nd, 2008 · 2 Comments · linux tips

When I tried to install wallpaperzapper in Ubuntu from the source, I got error macro ‘AM_GCONF_SOURCE_2′ not found in library. This link contain detailed description about this macro and for what purposes we can use it our configuration scripts.

This macro encapsulates all GConf related stuff and can used to determine the directory where .schemas files [...]

[Read more →]

Tags:

Using ‘find’ command in Linux

May 21st, 2008 · No Comments · linux tips

The find command allows the Linux users to process a set of files and/or directories in a file subtree.Users can specify where to search, what type of file to search for (-type: directories, data files, links), how to process the files (-exec: run a process against a selected file), the name of the file(s) (-name) [...]

[Read more →]

Tags: