Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Desperately need for help to understand C codes

Status
Not open for further replies.

kickbeer

Full Member level 3
Joined
Nov 7, 2008
Messages
162
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Activity points
2,356
Can someone explain me this codes:

/* Instruction emulation. */ This is comment
void __divsi3(void)
{
}

What means by instruction emulation?? why the word void is used 2 times? what does __divsi3 do actually? After that what does this {} do?
 

The first 'void' informs the compiler that this function returns nothing.
The second 'void' informs the compiler that this function takes no arguments.

Function return type: 'void' no return type
Function name: '__divsi3'
Function arguments: '(void)' no arguments.

The Braces would normally contain the code that implements the function.

void __divsi3(void)
{
c code to implement function
}

In this case, they contain nothing, so the function does nothing.

The comment

/* Instruction emulation. */

is written by the programmer, normally to make clear what the function does.
So this is meaningless. You could put any old gibberish here, it is ignored by the compiler.
This comment suggests that the function will emulate an assembler instruction, maybe some type of divide routine?

So, to sum up, it does nothing and is meaningless.

If you havnt already done so, get a book on
The C programming language.
 

Try reading this book.
"C for dummies".

The title is a bit insulting.
But trust me, it is a very well written book.
You will grab a good fundamental from this book.

I used to keep a list of good books,
**broken link removed**
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top