MosaicFuneral 812 Nearly a Posting Virtuoso
MosaicFuneral 812 Nearly a Posting Virtuoso
MosaicFuneral 812 Nearly a Posting Virtuoso
MosaicFuneral 812 Nearly a Posting Virtuoso
VX Heaven, that is all.
Dev-C++ and gcc are a bit different. At the core, though, they should be the same.
Dev-C++ is an IDE, not a compiler.
-> Did you ever read a book about operating system design ?
Who needs books on OS design? :P
How about no windows, and just a call that passes something to write(a box of pixels) to the video device? That's a lot of components of code to write just there.
By the way, Laik, how much of an OS do you have? You will probably want to lean more towards C than C++.
Lets take a look at a simple MASM32 program. Avoided invoke and macros for clarity.
.386
.model flat, stdcall
MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
ExitProcess PROTO :DWORD
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
msg_title db "Title", 0
msg_str db "Text.", 0
.code
start:
push 0
push offset msg_title
push offset msg_str
push 0
call MessageBoxA
push 0
call ExitProcess
end start
A brief C version.
#include <windows.h>
int main()
{
MessageBox(0, "Text.", "Title", MB_OK);
return(0);
}
Now, something you might see in a disassembler(@'s are xx's)
5469746C6500
546578742E00
6A00
6800xxxxxx
6806xxxxxx
6A00
E8xxxxxxxx
6A00
E8xxxxxxxx
FF25xxxxxxxx
FF25xxxxxxxx
That right there would be 427 ones and zeros, not including another KB of padding, headers, and tables. So unless you're one hardcore programmer, coding in machine code is beyond the scope of convention.
P.S. No one uses binary while dealing with op-codes.
1.
#include<stdio.h> int main() { int function(int); ...
Prototypes don't go inside other functions.
When did I ever say it should check grammar? Rather I said it should see if there was things such as: excessive capitals, no capitals, and other such things that might indicate a poor post. Checking grammar would be an exhaustive process.
To note, do not use exit(). In your main loop just break, and your destructors should clean anything.
You aren't serious! Are you ? :D
It's seems much more logical than what most of those, with offset thoughts, tossing their word-salads will suddenly say.
The "do something every Nth time through a loop" problem is probably where you'll see the modulus operator used most often.
I generally just use the logical AND operator for that.
'bout as well as it works for you.
Actually, I somehow think he's gone beyond bully and evolved into forum troll, back on his arrival at this site.
The linker doesn't need to know a thing about headers, that's all taken care of long before it gets to that point. A linker should just take your freshly compiled objects and put them together, in the proper system file format.
Search engines know all.
The one nieke_e posted and this tutorial http://www.codecolony.de/opengl.htm are my favorites, on OpenGL. I threw together a quick 2D engine, in about a day, after reading a few of those articles.
Build Your own RObot,
CRC's Handbook of Physics and Chem 63rd. ed. (always useful)
C# Pocket Reference
That's all I can think of, other than what I might have from the library at the moment.
dont mind me, im still figuring this site out.
768 post latter?!
But I believe the discussion about what instructions are generated by a compiler by the code you write is not at hand here.
True, just view my post as irrelevant or a minor side note of what might happen. What other time do I get to actually use this weird info, I've learned?
1) When I have
if (inventory.size() == MAX_ITEMS) { inventory.push_back("Rusty Armor"); } else { deleteItem(); }
uhmmm... If you have a full inventory of items, you get a free Rusty Armor, but if you don't you lose an item?
I think you meant to use inventory.size() != MAX_ITEMS
What are all those if() and array swaps in deleteItem()? It's unreadable, learn how to use loops.
You could also check it by using the following code:
if(p == NULL) { /* The memory wasn't allocated */ }
if(p == NULL)
is if(!p)
Where you allocate your pointer, notice something wrong with new's "type"?
By the way, you should be checking if you allocation was successful or not!
int *p;
try{
p = new int [5];
if(!p) throw; }
catch(...) {
emergency_handling(); }
type var_name = new type[n];
not type var_name = new var_name [n];
You need to establish a better naming system that allows you to recognize what is what, with just a glance.
Yes, i++ is just a shorthand for i = i + 1.
Well.... if I remember right, var++
and var--
on x86 style machines will generate INC and DEC instead of SUB and ADD. Which do not affect the carry flag and by not having a following value taking space: it keeps both written code and the generated executable leaner.
That might work as long as exe b is not running while exe a is writing to the file. Running executables can be opened for reading, but not for writing.
Quick fix, just have A wait till B isn't running, since most likely B would quit after it opens and passes data to A.
Show us the code, with CODE TAGS.
Yeah I'm aware of that, Im talking about for example
2 executables
exe a and exe b
exe a will configure/edit values of exe b
exe b will retain them and use them will running self contained
Best tut on the Windows 32 PE("exe") format
http://webster.cs.ucr.edu/Page_TechDocs/pe.txt
Exe A gets B's DOS header, with the PE offset it gets the IMAGE_NT_HEADERS, right afterwards is the section headers find your section, jump to that section and.... the rest is up to you.
True, but im looking for a PoC in a weird way, I need to do it in that specific way, no alternatives
Okay, but what OS are you on?
You could append the data to the end of the file, spread it through out unused header crap, or:
create your own section and declare a variable(preferably a string) inside of there, look up the section and overwrite the values with the new values.
Well why not just save it in a encrypted file? Keeps everything separate from getting lost.
The Art of C++ was a great book; regardless, perhaps you should turn it into a crude compiler that puts it into MASM32 mnemonic, or some other flow of choice.
Lets just simplify this to three methods:
One, create a resource file which the program will load. This is easily modifiable by external programs.
Two, use pipes and send something telling the program to use the following alternative data.
Three, open the executable, find the initialized data and overwrite it.
The first one is easy, but has to be done before execution; Second one may complicate things, if you do not think it through and design it as simple as possible; Third one is very involved and can drive you insane with things as simple as off-by-one errors.
Does your project require boost? I'd just avoid it altogether.
Then analyze if it is a formal title or group of numbers, before you split it off.
Huh? How does that link relate to this discussion?
It's a site about the evils of Wal-Mart.
You can get a Dell computer for under $500.00 USD at Wal-Mart. Or go online at www.walmart.com to see other models. Sorry is this post seems spammy, but I'm just answering the original post.
Oh, of course checking if there is more than 45% capital letters, which is probably a sign of using all caps or something like "tHiS".
In tech forms, when someone starts a new thread. It should be evaluated whether it has at least rudimentary sentence qualifiers, in the non-code tag fileds.
A crude list of requirements might be: at least on capital and lowercase letter, one of .,?!;, perhaps even no excessive usage of internet common acronyms(possibly to slow?).
Why should such a scanner be implemented:
Obviously, I am, as stated, talking about checking for the bare essential characteristics of a readable sentence. Otherwise anything more grammatically correct than that, would prevent a lot of people(including myself) from ever being able to post! lol
Although there could always be an "ignore it" option.
Eh? Impossible to read what? The site to which I linked to?
It was all purple, earlier:
http://www.daniweb.com/forums/thread184413.html
Where's the hentai previews?
I don't like have snippets seem random now... I want to know anything new is now available for any language.
Wow! That's the lamest "encryption" I've ever seen, hardly even a cipher.
Why not just allocate a single array and treat it as a x*y space. for every y spaces is a new x row
Less initializing time spent doing separate allocations, for every new row. Particularly if this code is only for small 2D arrays; for larger amounts of data and more involved code, you'll need to write a container or look into the ones C++ provides(ie. vector, map, stack, string(for all char types), et al.).
So like in games when you have the option of which device to use; the custom "plug-ins/updates" would contain the rules on how to interact with the unknown hardware?
VC++ does seem likely, but who cares?
http://www.kernel.org/
Dowload a source, and perhaps look around in:
If the file is NULL, then why are you still using it afterwords? Perhaps you should have one function to load, and one to save.
You aren't closing the file pointer after you're finished.
If you're writing drivers and crap for a CNC or something, then you could cost a business millions.
Two ways that might cause damage to a PC style computer: wrong BIOS call to a device erasing data, or throwing an old CPU(with design flaw, and inadequate cooling device) into somesort of lock till it overheated.
Oh, I doubt Dani wants to open the gates to hordes of pubescent leet gankers, pwning this and roflcoperting that and generally epeeing about the place.
I think we're starting to see them creep their way in now.
Wow! I can so easily guess your age from that reply of yours :icon_rolleyes:
Eight-through-twelve?
Why do you need Boost?
Why exactly are you allowed to do that?
Your outrage says I should give you a ticket. :P
As Danny said, declare seed in main().
Second, to have the function modify a variable you need something like void foo(int &bar);
note the "&".