Question for C++ guys

Moderator: BarsMonster

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
BarsMonster
Site Admin
Posts: 1118
Joined: Wed Oct 01, 2008 7:58 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Question for C++ guys

Post by BarsMonster » Thu Nov 20, 2008 6:39 am

Do you know how to make Visual Studio not to throw error when it expect signed it, and getting unsigned one?
That is total overkill for me to manually cast it every time :-S

GZero
Posts: 3
Joined: Tue Dec 09, 2008 11:09 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Question for C++ guys

Post by GZero » Tue Dec 09, 2008 12:00 pm

Perhaps I've misunderstood your question, could you provide some example code, and the error thrown?

On pretty much every C++ compiler I've used, the conversion between unsigned and signed integers is implicit.

e.g:

Code: Select all

	unsigned int uint = 1000;
	signed int result;
	result = uint;
	printf("Signed Representation: %d\nUnsigned Representation: %u\n\n", result, uint);
	uint = uint*-1;
	result = uint;
	printf("Signed Representation: %d\nUnsigned Representation: %u\n\n", result, uint);
Perhaps this is specific to the architecture you're working with, I don't know if CUDA requires an explicit conversion.

User avatar
BarsMonster
Site Admin
Posts: 1118
Joined: Wed Oct 01, 2008 7:58 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Question for C++ guys

Post by BarsMonster » Wed Dec 10, 2008 12:59 am

unsigned int uint = 1000;
signed int result;
result = uint;
This one causes error in Visual Studio 2005, so I have to write result = (int)uint; which is quite boring :crazy:

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest