Posts

Showing posts from March, 2009

Translation units & Linkage

Translation units
The term translation unit refers to a source code file together with any included files, but less any source lines omitted by conditional preprocessor directives. Syntactically, a translation unit is defined as a sequence of external declarations:

translation-unit:

external-declaration
translation-unit external-declaration
external-declaration
function-definition

declaration

word external has several connotations in C; here it refers to declarations made outside of any function, and which therefore have file scope. (External linkage is a distinct property; see the section
Any declaration that also reserves storage for an object or function is called a definition (or defining declaration).
Linkage
An executable program is usually created by compiling several independent translation units, then linking the resulting object files with preexisting libraries. A problem arises when the same identifier is declared in different scopes (for example, in different files), or declared mo…

Duration

Duration, closely related to storage class, defines the period during which the declared identifiers have real, physical objects allocated in memory. We also distinguish between compile-time and run-time objects. Variables, for instance, unlike typedefs and types, have real memory allocated during run time. There are three kinds of duration: static, local, and dynamic.

Static

Memory is allocated to objects with static duration as soon as execution is underway; this storage allocation lasts until the program terminates. Static duration objects usually reside in fixed data segments allocated according to the memory model in force, although in 32-bit development, only the flat memory model is supported. All functions, wherever defined, are objects with static duration. All variables with file scope have static duration. Other variables can be given static duration by using the explicit static or extern storage class specifiers.

Static duration objects are initialized to zero (or null) in th…

Name spaces & Visibility

Name space is the scope within which an identifier must be unique. C uses four distinct classes of identifiers:
Structure, union, and enumeration tags. These must be unique within the block in which they are defined. Tags declared outside of any function must be unique.
.
goto label names. These must be unique within the function in which they are declared

Variables, typedefs, functions, and enumeration members. These must be unique within the scope in which they are defined. Externally declared identifiers must be unique among externally declared variables.
Structure and union member names. These must be unique within the structure or union in which they are defined. There is no restriction on the type or offset of members with the same member name in different structures

Visibility:
The visibility of an identifier is that region of the program source code from which legal access can be made to the identifier's associated object.

Scope and visibility usually coincide, though …

Storage classes and types

Associating identifiers with objects requires each identifier to have at least two attributes: storage class and type (sometimes referred to as data type). The C++Builder compiler deduces these attributes from implicit or explicit declarations in the source code.

Storage class dictates the location (data segment, register, heap, or stack) of the object and its duration or lifetime (the entire running time of the program, or during execution of some blocks of code). Storage class can be established by the syntax of the declaration, by its placement in the source code, or by both of these factors.

The type determines how much memory is allocated to an object and how the program will interpret the bit patterns found in the object's storage allocation. A given data type can be viewed as the set of values (often implementation-dependent) that identifiers of that type can assume, together with the set of operations allowed on those values.
The compile-time operator, sizeof, lets you determ…

Language Structure

Image
C++ language and its implementation towards easy swift easy programming C++Builder.

Declarations:
This section briefly reviews concepts related to declarations: objects, storage classes, types, scope, visibility, duration, and linkage. A general knowledge of these is essential before tackling the full declaration syntax. Scope, visibility, duration, and linkage determine those portions of a program that can make legal references to an identifier in order to access its object

Objects:
An object is a specific region of memory that can hold a fixed or variable value (or set of values). (This use of the word object is different from the more general term used in object-oriented languages.) Each value has an associated name and type (also known as a data type). The name is used to access the object. This name can be a simple identifier, or it can be a complex expression that uniquely references the object.
The type is used

to determine the correct memory allocation required initially.
to interpre…

Home Wave Programming

Image
I have a 2GB DV MP5, MP4 Digital Player. I like the device as it comes with, a camera, player, video and also a webcam USB camera.
The only thing that disturbs me much is I can listen to the radio unless I insert the ear phone to improvise the antenna. Given the radio application, I wonder if it’s possible to program (write a code) in a way that would configure my radio application to receive signals that can be actually be close to an internet connection.

In other words, can the radio your listening to or the Aver TV card in your PC receive signals that can be interpreted through a programmed application be harnessed and with the blue tooth technology, establish an internet connection?

We had several ideas of how to easy program and experiment if it were possible but there happened to be draw backs along.
1. The radio waves been received by the media player with the radio receiver were not detected by our Blue tooth device.
2. Owing to the varying between the blue tooth device communic…

Idea: Phone Programming

Image
Programming has gone up to another level. I was looking at my phone and at one point an idea came up my mind.

How can we program to make things easy and swifter?
I’ve got an idea. New phones are been poured in the market every day.
What if you programmed a phone that could do the following for you?

When you get in a dark room, you don’t have to look for the switch. Reach for the phone in the pocket scroll through your menu, select switch icon and click lights on. This would be very secure as will make a move once the lights are on.

Oh yah I forgot, we parked our car but left the keys inside the car. How can programming save us this time? Lets program the same phone in such a way that I don’t have to go out of the house again to set the car alarm on or break the window to get my keys. Possible. Select menu on your phone, select the related icon car for example and press alarm on. Or the function can be coded in such a way you can memorize the numbers if that’s not to tiresome. Number 1 for …

Programming: Borland C++

Image
The DOS programming application provides a user friendly and easy
to understand programming ground.
The Borland C++ compiler can be configured to wok on any PC. You don’t have to panic that your PC is too old. Start programming with what you have.










Lets Go through an example:
The first input is your library headers example #include. This tells the compiler to check in the library standard input /out put for the functions that were used in your source program. Example is the main() function.
Main() is the beginning of your source file although other source code may come before the main() function. These are mainly function defined by the developer, constants, global variables and many more.
By typing a keyword on the screen, it is possible to get help and examples by placing the cursor below the start of the keyword and then pressing Ctl+F1In the example below the word disk has been type in disk for example as shown on the screen beside.





On pressing Ctl+F1 you get:
























A list of function words with…

Basics

Understand the following so as get a strong structural understanding:
1.Local Variable
2.Global Variables
3.Storage Class Specifiers
4.Extern
5.Static Variables
6.Static Local , Global Variables and Register Variables
7.Assignment Statements
8.Mutiple Assignments
9.Type Conversition
10.Variable Initialization
11.ConstantsOperators
12.Type Converstion
13.Cast
The above are very important
Close Lookat programming basics

Hitting The Road: Start Programming

How to start programming? Yes you can do it in an hour. Get the numerous made simple programming tools under google search.

Tools offer a simpler and more elaborate manner of programming. Why go back to the days of starting from scratch when all the programmers are serving on the new programming made simple tools.

These tools have templates and easy to use interface, that allows you to choose components you want to use in your program. They allow you to directly modify the properties of the components with ease. This cuts down your developing time by nearly 80%.

By saving your templates you can reuse them. How simple.
1Open a made simple programming tool
2. Create a new file
3. Place the components you want to use in your application
4. Change prosperities of the components to suite the way you want them to work
5. Enter your code
6. Use a resource builder to bid your projects to executable Win applications
7. Get market for your applications
What seems to be a scary storm turn out to be a clear…

Who Can Program Better Than You?

In the old time when people used to program using difficult codes no one ever thought of joining classes as the lessons were similar to counting the sand particles in the Sea.

Now look what is happening in the Markets, in the Industry and even with Private, Businesses.

Any programming language is earning a red carpet welcoming as the demand to design, build and manage the overall activities in the World Market fetches for more simple but more sophisticated applications to satisfy their market needs.
So where have those who are willing to learn the any programming language gone? When I started learning my first programming language I made one terrible mistake.


I showed no Interest in learning how to program and this made my learning more difficult.

Interest is the drive to learning any programming language that you dream to be perfect in.

The secret to program lies in you. You know why?
You might have had a chat on the net and someone happened to tell you that he is good is bringing down PCs,…