parameters "c style" in a C++ constructor (use of __attribute__)

Discussion in 'C++' started by timor.super@gmail.com, Feb 28, 2007.

  1. Guest

    Hi all,
    in a .c file, i'm using a var :

    const unsigned char myVar[8] __attribute__ ((aligned (4))) = {1, 2, 2,
    1, 2, 2, 2};

    this var is used by a C function : myCFunction(myVar) ...

    this is working ...

    but now, I want to make a class using this C function, i'm doing :

    class MyClass
    {
    MyClass(const unsigned char *);
    };

    MyClass::MyClass(const unsigned char *c)
    {
    myCFunction(c);
    }

    this is compiling, but the function doesn't make the good effect,
    probably due to the __attribute__ ((aligned (4))) .

    If I don't use the __attribute__ ((aligned (4))) in the .c file, the
    function is still working, but I shouldn't modify the .c file, how can
    I do to make it working ?

    Thanks for your help

    Best regards

    S.
     
    , Feb 28, 2007
    #1
    1. Advertising

  2. Ian Collins Guest

    wrote:
    > Hi all,
    > in a .c file, i'm using a var :
    >
    > const unsigned char myVar[8] __attribute__ ((aligned (4))) = {1, 2, 2,
    > 1, 2, 2, 2};
    >

    That's all rather non-standard, better to ask in a compiler specific group.

    --
    Ian Collins.
     
    Ian Collins, Feb 28, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krzysztof Kolago

    Problem with __attribute__

    Krzysztof Kolago, Nov 19, 2003, in forum: C++
    Replies:
    1
    Views:
    418
    Victor Bazarov
    Nov 19, 2003
  2. ritesh

    Error using '__attribute__'

    ritesh, May 18, 2006, in forum: C Programming
    Replies:
    5
    Views:
    416
    Jordan Abel
    May 18, 2006
  3. __attribute__ ((mode(__byte__)))

    , Oct 9, 2007, in forum: C Programming
    Replies:
    4
    Views:
    636
    Keith Thompson
    Oct 9, 2007
  4. nagaraj
    Replies:
    0
    Views:
    522
    nagaraj
    Apr 14, 2008
  5. parag
    Replies:
    0
    Views:
    230
    parag
    Jun 13, 2011
Loading...

Share This Page