By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

type of sizeof

P: n/a
Hi,

what is the type of sizeof?

Here is some lines of code from a programm, which I'm porting to x86-64:

char buffer[512];
unsigned size = content_size;
while (size > 0
&& (in.read(buffer, std::min(sizeof(buffer), size)), in.gcount() > 0))
...

This does not work, because sizeof(buffer) is not of type unsigned. My
complier (g++-3.3 on linux) tells me:
error: no matching function for call to `min(long unsigned int,
unsigned int&)'

So what is the right (and portable) type to use here?
Tommi
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Tommi Mäkitalo" <to***@maekitalo.de> wrote in message
news:c9**********@online.de...
Hi,

what is the type of sizeof?
size_t (or std::size_t if you prefer)

Here is some lines of code from a programm, which I'm porting to x86-64:

char buffer[512];
unsigned size = content_size;
while (size > 0
&& (in.read(buffer, std::min(sizeof(buffer), size)), in.gcount() > 0)) ...

This does not work, because sizeof(buffer) is not of type unsigned. My
complier (g++-3.3 on linux) tells me:
error: no matching function for call to `min(long unsigned int,
unsigned int&)'

So what is the right (and portable) type to use here?

size_t.

john
Tommi

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.