Search found 8 matches

by Fanael
Mon Jun 28, 2010 5:21 pm
Forum: C and C++
Topic: Visual C++ compiling help
Replies: 22
Views: 38259

Re: Visual C++ compiling help

It doesn't? So why

Code: Select all

#include <cstdio>

template <typename T> void foo(const T& x)
{ std::printf("%d\n", sizeof x);
}

int main()
{
  int arr[8], *ptr;

  foo(arr);
  foo(ptr);
}
does print two different values (assuming sizeof ptr != 8 * sizeof(int))?
by Fanael
Mon Jun 28, 2010 3:48 pm
Forum: C and C++
Topic: Visual C++ compiling help
Replies: 22
Views: 38259

Re: Visual C++ compiling help

As far as the programmer is concerned, arrays and pointers to the first element are synonomous when dealing with this error. Mainly because there was no array at all, since the code was erroneous (it's not possible to define an array of unknown size without initializer list), eh? Really, please dis...
by Fanael
Mon Jun 28, 2010 2:24 pm
Forum: C and C++
Topic: Visual C++ compiling help
Replies: 22
Views: 38259

Re: Visual C++ compiling help

Nope - sadly you are wrong. Array syntax is just an abstraction to make pointers easier to deal with. In terms of C, an array name is a pointer to the beginning of the block of memory, and elemets of the array are accessed using (pointer + element_number*element_size). Heh, actually it's you who is...
by Fanael
Mon Jun 28, 2010 12:33 pm
Forum: C and C++
Topic: Visual C++ compiling help
Replies: 22
Views: 38259

Re: Visual C++ compiling help

Correct me if I'm wrong, but under normal circumstances, an array is a pointer to a range of contiguous memory, so the notion of a pointer in the error message is correct. No, it's not. An array is an array, a pointer is a pointer, they're completely unrelated things, even though there is an implic...
by Fanael
Sun May 02, 2010 1:20 pm
Forum: Beginning OS Development
Topic: Demo 15 Problem
Replies: 25
Views: 42969

Re: Demo 15 Problem

Andyhhp wrote:ahh. I forgot about alignment problems

a better method is to use "__attribute__((packet))" which will ensure that no padding happens

~Andrew
Isn't it "__attribute__((packed))"?
by Fanael
Sat Feb 20, 2010 5:56 pm
Forum: Beginners
Topic: virtual memory
Replies: 33
Views: 102078

Re: virtual memory

xixpsychoxix wrote:How do I use the virtual memory manager to map these addresses to physical addresses?
You're using it incorrectly.
by Fanael
Sat Feb 20, 2010 1:00 am
Forum: Beginning OS Development
Topic: GCC/Binutils, I want to help
Replies: 5
Views: 9452

Re: GCC/Binutils, I want to help

He doesn't want help, he wants to help, presumably with writing a chapter about configuring Cygwin for operating systems' development. Did I understand correctly?