an explanation for the more noobish of us? what's wrong with that definition? >_<;
0x10 in 16 in hex.
Just became a father to a beautiful baby girl on January 21st, 2013!
Male
Rattrap hasn't added any contacts yet.
Posted by Rattrap
on 18 March 2013 - 11:07 AM
an explanation for the more noobish of us? what's wrong with that definition? >_<;
0x10 in 16 in hex.
Posted by Rattrap
on 16 January 2013 - 07:04 AM
Can't bring myself to do it.
Why?
This code is basically self documenting and much easier to read.
Posted by Rattrap
on 20 November 2012 - 07:00 AM
Posted by Rattrap
on 07 November 2011 - 09:52 AM
In my Game Actor class constructor I pass a boost::shared_ptr<IEventListener*>(this) to the Event Manager so I guess in essence I do what you say (using a raw pointer twice)
Posted by Rattrap
on 05 November 2011 - 08:56 AM
Hi,
Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11.
Amusingly, when this was originally reported in July 2006 (months before I joined the VC team), this was indeed By Design. C++03 23.2.4.2 [lib.vector.capacity]/6 specified:
void resize(size_type sz, T c = T());
Now, C++11 23.3.6.3 [vector.capacity]/9, 11 specifies:
void resize(size_type sz);
void resize(size_type sz, const T& c);
This change was introduced in March 2008's Working Paper N2588.
If you have any further questions, feel free to E-mail me at stl@microsoft.com .
Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Rattrap
on 13 September 2011 - 05:50 AM
Posted by Rattrap
on 23 August 2011 - 06:04 AM
void AddTexture(std::string textureName, std::string filename) { ..... Textures[textureName] = texture; // a raw pointer here; [b]should I "wrap" it into an intrusive_ptr[/b]? }
void AddTexture(std::string textureName, std::string filename)
{
....
Textures[textureName] = d3dtexture_t(texture, false);
}
Posted by Rattrap
on 20 July 2011 - 02:50 PM
typedef boost::mutex mutex_t;
typedef mutex_t::scoped_lock lock_t;
std::queue<std::tr1::function<void ()> > Jobs;
__declspec(dllexport) Indigo::Worker::Worker()
{
active = true;
Thread = boost::thread(&Worker::Work, this);
}
__declspec(dllexport) Indigo::Worker::~Worker()
{
lock_t Lock(mutex);
active = false;
// Ensure there are no remaining jobs in the queue (this is probably overkill)
while(Jobs.empty() == false)
{
Jobs.pop();
}
}
__declspec(dllexport) void Indigo::Worker::Work()
{
// Checking active will probably need to be atomic
lock_t Lock(mutex);
while (active)
{
if(Jobs.empty() == false)
{
// Execute the first job in the queue
Jobs.front();
// Remove the job from the queue
Jobs.pop();
}
else
{
boost::thread::yield();
}
}
}
__declspec(dllexport) void Indigo::Worker::Add(boost::function<void ()> Func)
{
lock_t Lock(mutex);
Jobs.push(Func);
}
Posted by Rattrap
on 19 July 2011 - 03:53 PM
Mutex_A.lock(); //don't continue until A is finished Mutex_B.lock(); //don't continue until B is finished Mutex_C.lock(); //don't continue until C is finished //TODO: Finish with Update A, B & C resources Mutex_A.unlock(); //free A for next loop Mutex_B.unlock(); //free B for next loop Mutex_C.unlock(); //free C for next loop };
Posted by Rattrap
on 19 July 2011 - 08:05 AM
do you think they could be causing the problem of the program doing nothing?
if so what would I be looking for that indicates CLI?
I'm unfamiliar with the language, but taking a quick google it seems similar to C# (with that being the coding language I'm most familiar with its plausible I used similar code in C++ by mistake)
Posted by Rattrap
on 19 July 2011 - 07:42 AM
Posted by Rattrap
on 19 July 2011 - 06:55 AM
I'm not using C++/CLI... at least not to my knowledge
Intellisence still works and it was to my understanding it didn't work with projects that included / used C++/CLI (I've come across VS 2010 commenting on it in the bottom right corner when looking at certain code examples)
1>------ Build started: Project: CLRTest, Configuration: Debug Win32 ------
1>Build started 7/19/2011 8:51:27 AM.
1>InitializeBuildStatus:
1> Creating "E:\Programming\CLRTest\_Obj\Win32\Debug\CLRTest\CLRTest.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> stdafx.cpp
1> AssemblyInfo.cpp
1> CLRTest.cpp
1> Generating Code...
1>e:\programming\boost\boost\thread\win32\basic_timed_mutex.hpp(160): warning C4793: 'boost::detail::basic_timed_mutex::unlock' : function compiled as native :
1> Found an intrinsic not supported in managed code
1>e:\programming\boost\boost\thread\win32\thread_primitives.hpp(314): warning C4793: 'boost::detail::win32::interlocked_bit_test_and_set' : function compiled as native :
1> Found an intrinsic not supported in managed code
1> .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1>C:\Users\Rob Yull\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp : fatal error C1083: Cannot open compiler generated file: 'E:\Programming\CLRTest\_Obj\Win32\Debug\CLRTest\C:\Users\Rob Yull\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.obj': Invalid argument
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:04.30
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Posted by Rattrap
on 18 July 2011 - 12:31 PM
#include <iostream>
#include <string>
int main(int argc, char *argv[]) {
std::string name;
name.reserve(32);
for(int i=0;i<8192;i++) {
std::cout << "Argument count: " << argc << '\n';
for(int j=0;j<argc;j++) {
std::cout << "Name: " << argv[j] << '\n';
}
}
std::cin >> name;
std::cout << "Hello " << name << "!" << std::endl;
return 0;
}
Posted by Rattrap
on 14 July 2011 - 06:09 AM
Exceptions all boil down to two extremes: "handle the problem immediately and locally, and gosh darnit now I have to remember to wrap every call to this function" or the other extreme, "stop everything, and move on." In the latter case it's perfectly fine to use a return code. Return codes, in the places where you want them, are not actually strenuous.
Exceptions are less scary in memory-safe languages and so their use is less discouraged.
Find content