#includes

closed account (SECMoG1T)
hi everyone, i want your help on some questions and i will appreciate your responce so much, well i have been wondering for sometimes
and i still don't understand one or two things,

1. can the efficiency of a program be affected by the number of #includes
you'v included in it , for example according to my understanding the reason i
create different headers for each type of unrelated objects is to make my
program readable and also help me in debugging but a question of efficiency
arises if i make too many headers, is it possible that this will affect my
program efficiency by adding some overhead as the preprocessor loads
them than if i just joined them into one file?

2. i see some programs including some DLL files, i can't read DLL file
codes as they are written in some funny binaries ( f4,3c,00,1f) i don't
know what this really are, i also heard that this files are more faster
than the static libraries (not sure), question is are these things coded as
i do for my headers?, if so how can they be made? what are those
binary looking numbers, where do i learn them? iknow this Q is not best ask
in this forum but it is my only reference please just help me, thanks.

3. i saw a particular code like the one below please tell me what it really
means , what are these (hex's) i quite dont
understand please help me understand i will verily appreciate your
kind response, thanks again.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    bool isStrWhiteSpace(UChar c)
    {
      switch (c) {
        case 0x0009:
        case 0x000A:
        case 0x000B: /// what does this code suppose to mean.
        case 0x000C: /// what are this hexadecimals????
        case 0x000D:
        case 0x0020:
        case 0x00A0:
        case 0x2028:
        case 0x2029:
        case 0xFEFF:
            return true;
        default:
            return c > 0xff && isspace(c);
       }
    }
    
Last edited on
Including files does not affect the performance of your code. This might affect the code at compile time, i.e. take longer to compile, but after the code is compiled to machine code, there is no such thing as includes. In fact at that stage, you can go ahead and delete your source code and it will do nothing to the compiled binary (don't do this if it is important).

Not sure about DLLs', but if you google it, I'm sure you will find something

http://www.asciitable.com/
The above site shows the different values for most of these hex values you found in the code. For example 0x9 (note zeros don't matter) is equivalent to a horizontal tab. From the function name, and the different values for the hex numbers, you can guess what this function does.
0xff is the value 255, see this http://www.binaryhexconverter.com/hex-to-decimal-converter
closed account (SECMoG1T)
thank you very much @smac
you amaze me here you can go ahead and delete your source code and it will do nothing to the compiled binary is it that after compilation the code binaries are stored somewhere else (like a directory or something) ? i surely dont get something here lol, so it
is like the program is no more the code after compilation ? that would be amaizing and would help me understand yet another question (so an .exe contains only binaries not the
source code? )

for the hexs lemmi check the links and see what they'v got but why would one prefer to use hexadecimals (looking so complicated) is it because they are somehow faster in processing than other types haha??? or what's the deal with them? thanks so much anyway for your time.
so it is like the program is no more the code after compilation

Correct. The compiler turns your source code into object code (.obj). Object code files contain machine instructions and data. Your source code is no longer needed. The linker combines object files together to make an executable (.exe).

so an .exe contains only binaries not the source code?

Correct.

why would one prefer to use hexadecimals

Since hex is a multiple of base 2, hex is often used when dealing with the machine representation of numbers. For example in line 16, it is very easy to see that 0xff is an 8 bit mask. 255 would accomplish the same thing but is not as clear.

is it because they are somehow faster in processing than other types

No. All numbers are represented in computers as binary. There is no speed difference. The only difference is in how we as humans read them.
closed account (SECMoG1T)
Thanks @abstraction you made it clearer so you mean when I run a program
The exe object is run? Is it possible to extract this exe object from my project
After compilation? If so how can I run this exe after I extract it ? Can it be debugged?

0xff is an 8 bit mask.  sounds like something I wanna learn, masking? Give me a resource
Direction , thank you very much.
so you mean when I run a program the exe object is run?

Yes.

Is it possible to extract this exe object from my project after compilation?

Yes. In general for a debug build, your IDE will create a debug folder under your project that contains your .obj files and the final .exe file. You can simply type the name of that .exe file at a command prompt and it should run.

Can it be debugged?

That depends on whether the .exe file includes symbols. For debug builds, this is usually true. Debug symbols are not the same as source code, although they contain pointers to the source code so the debugger can display the source code as you are debugging.

Give me a resource

http://www.cplusplus.com/doc/boolean/


Topic archived. No new replies allowed.