Jump to content

  • Log In with Google      Sign In   
  • Create Account

Bregma

Member Since 09 Dec 2005
Offline Last Active Today, 09:11 PM

#5160288 using static initialisation for paralelization?

Posted by Bregma on 13 June 2014 - 07:43 AM


how is the mechanizm it slowed my program and growed it +50KB

I suspect, without proof, that it pulled in some library code to wrap and serialize the initialization of the function-local statics, and the slowdown is because that code gets executed.  Thread serialization generally requires context switches and pipeline stalls.  Without knowing the code, I suspect that code path needs to be executed every time so it can check to see if the object has been initialized.




#5160269 using static initialisation for paralelization?

Posted by Bregma on 13 June 2014 - 05:12 AM

No.  It did it so if you are initializing static-local functions in a multi-threaded environment, it will have defined results.

 

It certainly does not affect namespace-level static initialization, not does it imply anything about the introduction of a threaded environment during application initialization.




#5159569 Step by step ARM emulator

Posted by Bregma on 10 June 2014 - 01:05 PM

Perhaps a combination of QEmu and GDB might work?




#5159330 remapping the keyboard (esp {} () )

Posted by Bregma on 09 June 2014 - 02:05 PM


Its okay for me, i strongly do not want tu use all fingers,
the problem is i do not like move hands i just like move fingers

Well, I can't help at all because I'm not familiar with Microsoft Windows, but I wish you luck.  It's important that you bend technology to your needs, not bend to the needs of technology. There's no doubt that keyboard technology was invented purely to meet the needs of 19th century technology.  Go and invent a better keyboard.




#5157979 what is most difficult in programming to you?

Posted by Bregma on 03 June 2014 - 07:03 PM

Trying to decide between two (or sometimes more) relatively equally good alternatives, usually for minor details.  The result is frequent decision paralysis.




#5157909 will make help me?

Posted by Bregma on 03 June 2014 - 12:43 PM


- scan given folder tree find all .o files and flush this with path into some linker bat file

That required the object files be built first.

 

I strongly suggest you try to learn something like CMake.  It allows you to specify only the primary dependencies (.c or .cpp files) and the target binaries (.exe files) and the rest is magic.  In your case, you would use it to generate makefiles which you would run with make in the mingw environment.  You can even write a custom rule to generate to metamega header file.




#5157904 will make help me?

Posted by Bregma on 03 June 2014 - 12:37 PM


An IDE will do it all automatically for you

If, by 'automatic' you mean manually constructing the primary dependencies.  Dragging and dropping pictures of words in a picture of a directory hierarchy instead of editing a text file.  It's really the same amount of work, just a different medium.

 

Both are also still much less work than the way OP appears to be doing stuff at present.




#5157854 will make help me?

Posted by Bregma on 03 June 2014 - 10:04 AM

No, make will not help you here.

 

The purpose of make is to rebuild only what has changed, and to make sure everything that depends on a change gets rebuilt (rebuild everything that's necessary, but no more).  You still need to specify dependencies somehow.  Much of the point of make is defeated if you have One Big Header that includes all other headers.

 

If you're using GNU make and the GNU compiler collection, you can use extensions that will calculate compile-time dependencies, eliminating much of the work:  that's how wrappers like the Linux kconfig system and the GNU autotools work:  you simply specifiy the translation units (generally .c or .cpp files) and the rest gets determined at build time.  Other wrappers like CMake reinvent that using their own separate codebase.  These will still give you build-time grief because of your "simplified" headers, but will be less work for you to maintain the dependencies.

 

You might also consider breaking your projects down into modules using static libraries, so each only needs to be rebuilt when the module changes and the public API is limited to the public library API:  this should simplify your link command lines and header structure in a good way, making any tight coupling manifest.

 

So, make on its own will not help you here, but using make in conjunction with wrapper tools developed over the last half century or so to solve your problems will definitely help solve your problems.  It's definitely worth your looking in to.




#5154802 Location of data in the class

Posted by Bregma on 20 May 2014 - 07:01 AM


was also curious if the same could be said for functions arguments,

Vector4(float _x, float _y, float _z, float _w);

Would all these be in the same order and sequential?

Definitely not.  Most early compilers for PDP and related architectures (VAX, PPC) always pushed arguments on the stack in reverse order.  SPARCs and IBM mainframes would always pass 4 float args like in the example above in registers.  I believe many currently-popular compilers will push the args on the stack in-order unless there are free registers, in which case one or more are passed in registers, depending on the optimization settings and link visibility.  Of course, the compile could choose to inline the entire function, in which case there are no parameters.

 

So, no, never ever depend on the arguments to a function being in the same order and sequential in memory.




#5154705 File Loading Adds Weird Characters to the end

Posted by Bregma on 19 May 2014 - 04:59 PM


shouldn't a text file which is basically just a really long char have the 0 at the end

A file on most modern operating systems is just a stream of bytes.  Technically there is not really such a thing as a 'text file', just a stream of printable characters mixed with line-end markers (like LF on Unix, or CR/LF on DOS) and storing null-terminated C strings in a file will make it unreadable by things that expect traditional text, like text editors.

 

So, no, string a null byte at the end of a string in a 'text file' would be unexpected.  The conversion to C-syle strings needs to be done when the file is read by a C program (or Pascal-style strings when the file is read by a Pascal program, or....).




#5153991 Is coding games for touch screens difficult?

Posted by Bregma on 16 May 2014 - 06:56 AM

I spent a couple years integrating touchscreen and multi-touch gestures into software.  There are a few aspects to consider.

 

(1) Most people expect single touches to act much like mouse events.  Touch down/up are like button down/up and in between are like drag events.  If that's all you want, your toolkit should take care of it.  The main difference is the target:  people expect to be able to drag window pane content using a touch in a way they don't with a mouse.

 

(2) Single-touch complex ("stroke") gestures.  You can handle those yourself (using the above), or use a third-party library like $1.  Note that this sort of thing generally lacks discoverability, but I guess it depends on your game design.

 

(3) Multi-touch gestures.  If you're smart you will use your toolkit to handle these and simply receive gesture begin/update/end events like you do with any other input.  If you're ambitious, you can write your own gesture recognizer to integrate individual touch events over the time and space domains and worry about the combinatorics yourself.

 

There are some cool non-gesture multi-touch things you can do with touchscreens.  Imagine a version of Pong where the paddle appears where you put your fingers, and three fingers can make a curved paddle for trick shots.




#5149352 Do Giant Eyeballs with Tentacles Appear Too Much?

Posted by Bregma on 25 April 2014 - 05:22 AM

I see them everywhere, and now you tell me you're adding them to games too?




#5149136 copy/assignment/move constructors and private data

Posted by Bregma on 24 April 2014 - 05:17 AM

But... keep in mind the need to grab the private parts of another object is a code smell very indicative of poor design.  You might want to re-think the single purpose of your class(es) or their interface(s) before your project grows much more.




#5148110 What is the point of blocking sockets?

Posted by Bregma on 19 April 2014 - 06:21 AM


Apart from toy programs - is there a use for blocking sockets?

Using a blocking socket is a common and sane way to implement a server.  In fact, it's pretty rare that you need non-blocking sockets in my experience.

 

Almost all servers I've had the pleasure of working with use socket multiplexing and blocking sockets.  The code is simpler and less error-prone.  Unless you've written erroneous code, it's not possible to block indefinitely on a read, because you only read when the multiplexor (select()/poll()/epoll()/kqueue() etc) indicates data is available.




#5147380 c++ oo syntax behind the scenes behavior

Posted by Bregma on 16 April 2014 - 10:29 AM


If you add more virtual functions, the class size does not grow though.

That can be a little misleading.  The size of objects (class instances) does not grow, but the vtable size changes, and maybe even its layout changes.  That's important to know, because it's an ABI change and the not infrequent cause of subtle and inexplicable runtime failures.

 

This sort of thing shows up as a problem if, for example, you add a virtual function to a header file and rebuild a program, but do not rebuild a DLL that also uses the header file.  Bam!






PARTNERS