Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:43:10+00:00 2026-06-08T21:43:10+00:00

EDIT:This is from a working project of mine. Working. I declared some char arrays

  • 0

EDIT:This is from a working project of mine. Working.
I declared some char arrays at the beginning of .cpp file(even before the #include parts). Then i could use these arrays with “instructions for 16-Byte aligned variables”.

Question: what happens if i use this .cpp file in another .cpp file as an include? Could i use that arrays for aligned operations in another projects too?

Question-2: is there a short-cut for this? I dont want to place all my variables in the beginning.

Some of the code:(i worked on some 16-Byte-aligned arrays)

    //I put these arrays at the beginning, so they are aligned
//for the movaps instructions(x2 speed for reading and writing memory)
float v1[16];
float v2[16];
char counters[32];
char array_of_ones[32];
char source_array[4096];
char destination_array[4096];   
struct bit_field
{
    bf1:32; 
    bf2:32;
    bf3:32;
    bf4:32;
}some_area;
struct bit_mask_x
{
    bf1:32;
    bf2:32;
    bf3:32;
    bf4:32;
}some_mask;
float var_fast[16];
char alignment_purge[5];    //for the unalignment tests
char unaligned_source_array[4096];
char unaligned_destination_array[4096];



#include <math.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
.....
.....

What happens if i include this program in another like this:

#include <math.h>
#include<my_aligned.h> <-------- or my_aligned.cpp
#include<stdio.h>
#include<time.h>

Do i have to use a .h file for this?

Thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:43:12+00:00Added an answer on June 8, 2026 at 9:43 pm

    Have you actually tried if this aligns your variables correctly? When you compile, the executable always has a header whose size may not be a multiple of 16. Also, alignment_purge may not really get the variables following it out of alignment, because the compiler may add padding. Finally, the headers don’t introduce variables, so if you put your variables above or below headers, that doesn’t change anything.

    You can take a look at this question to see how to request aligned memory.

    As a side note, normally you wouldn’t want to include source files into another file. See this question on this subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller in MVC serving up images from a database. EDIT: This
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
I have this function to edit all fields that come from the form and
how does one use code to do this: produce 15 random numbers [EDIT: from
EDIT : This has begun working and I have not changed anything, this is
EDIT: This is weird... if I double-click the Recent Projects item for the project
I'm currently editing a working project with some experience on PHP. I know a
I am moving a project from working with standard DB queries to working with
I'm working on a project, this project must have many users, each user can
Currently working on a project to upgrade our Goole Maps API from v2 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.