Visual C++ Compiler ERROR C2016

December 29, 2009

Compiling a C file with Visual Studio 2008 compiler I got this error: "error C2016: C requires that a struct or union has at least one member" I am writing this post because it is not documented, and C2016 on MSDN is defined as "A newline character was found before the closing single quotation mark of a character constant". Either it is not well documented or I don't know where to look for it. Whatever the reason I can only guess that someone else will find the same problem. This is the cause: struct{   int    u8Type;   int    u8LenExtended;   int   u16Length;} Base_Request; struct Request_Ex{   Base_Request Request;  ...
tags: ,
2 comments

Pacific Software & HPC

December 27, 2009

מזה מספר שנים שחברת פסיפיק תוכנה מובילה בתחום הפיתוח המקבילי בארץ. בקרוב מיקרוסופט מוציאה את גרסת Server 2008 HPC R2 ופסיפיק מחפשת מומחי IT שמתעניינים בתחום הקמה ותחזוקה של מערכות HPC  אסף
no comments

Verifying C++ Buffers

This post is following this post: Verifying Pointers in C++ which demonstrated the problem in testing a pointer for NULL after allocation like this:char* ptr=new char;if (NULL == ptr) // fail There is another issue with verifying pointers for NULL. The value NULL is #defined as 0 (zero) which is agreed to be an invalid memory address. Testing a pointer to see if it is NULL means testing to see if the pointer is pointing to address zero or not. As we all know, when we allocate a buffer and then delete it we must zero the pointer. Verifying a pointer...
no comments

WinUSB Read Problem

December 22, 2009

Hi All, I have decided to move forward from my implementation of BulkUSB.sys driver to using the formal implementation called WinUSB. It is a package of a kernel driver and a user-mode API documented as part of the MSDN library. When I tried to do asynchronous reads I discovered two undocumented / confusing failures: The first is GetLastError returns 997 - ERROR_IO_PENDING. This is fine for overlapped IO. The function fails and the error code means that there is more data to follow. The second is somewhat confusing: GetLastError returns 121 - ERROR_SEM_TIMEOUT "The semaphore timeout period has expired". This means that the timeout...
tags: , ,
no comments

Parallel Computing Tutorial

With some delay I am publishing a video about parallel programming. This tutorial is loaded with advanced concepts mainly dealing with parallel software design and architecture. As some of you may know I have presented "Parallel Programming for Embedded" TechEd 2009 Europe. This is the video. There are no code samples in this presentations because there are too many languages and operating systems that it is irrelevant to show any code. Instead this presentation shows how the hardware has always been parallel and therefore it is a good source for parallel design. Windows Kernel has always been working in parallel as well,...

Verifying Pointers in C++

It is well known that C++ is having a few problems with pointers... When we used C style malloc( ) and free( ) we verified the returned pointer. If the pointer was NULL (zero) then it was invalid and should not be used. Going to C++ we have constructors. A constructor does not have a return value so the only way to notify the caller that the construction failed was using an exception. If my object is using an internal buffer and the system is out of memory then my constructor has to throw an out-of-memory exception. The caller who created my object...
tags:
no comments

Open Source Libraries for windows

December 20, 2009

Hi All, As you can see I have upgraded the shared-source engine (see my previous post http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/21/sharing-my-source.aspx) The Open-Source section in www.AsyncOp.com now has the complete collection of modules and C++ classes that I have been using for Windows. These include threading and shared memory classes, string classes, communications, graphics and more. Not exactly MFC style classes but will work with MFC. The code is compatible with MFC, Borland C++, Managed C++, and will also work with native Win32 API. For example the text class can open a web-page and read from it using >> operators. It can also find an HTML title by...