Enviado em 23/04/2019 - 05:05h
Olá pessoal !!!
//-------------------------------------------------------------------
//
// Saida Windows 64 bits:
// ------------------------------------------------------------------
//
// 0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
// sizeof(int): 4, sizeof(long): 4
//
//-------------------------------------------------------------------
//
// Saida Linux 64 bits:
// ------------------------------------------------------------------
//
// 0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
// sizeof(int): 4, sizeof(long): 8
//
//-------------------------------------------------------------------
//
#include <stdio.h>
#define UC unsigned char
unsigned char buf[100] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 };
long l = 100000000;
void funcao() {
*(int*)buf = l;
printf("0: 0x%x, 1: 0x%x, 2: 0x%x, 3: 0x%x, 4: 0x%x, 5: 0x%x, 6: 0x%x, 7: 0x%x, 8: 0x%x, 9: 0x%x, 10: 0x%x,\n", (UC)buf[0], (UC)buf[1], (UC)buf[2], (UC)buf[3], (UC)buf[4], (UC)buf[5], (UC)buf[6], (UC)buf[7], (UC)buf[8], (UC)buf[9], (UC)buf[10] );
}
int main (void) {
funcao();
printf ("sizeof(int): %d, sizeof(long): %d\n", (int)sizeof(int), (int)sizeof(long));
return 0;
}
Saida Windows 64 bits:
------------------------------------------------------------------
0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
sizeof(int): 4, sizeof(long): 4
-------------------------------------------------------------------
Saida Linux 64 bits:
------------------------------------------------------------------
0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
sizeof(int): 4, sizeof(long): 8
-------------------------------------------------------------------
O que é o THP na configuração de RAM do Linux e quando desabilitá-lo
Comparação entre os escalonadores BFQ e MQ-Deadline (acesso a disco) no Arch e Debian
Conciliando o uso da ZRAM e SWAP em disco na sua máquina
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Como unir duas coleções de ROMs preservando as versões traduzidas (sem duplicatas)
Como instalar o Telegram Desktop no Ubuntu 24.04
Overclocking Permanente para Drastic no Miyoo Mini Plus
Problemas de chaves (/usr/share/keyrings) no Debian
Converter os repositórios Debian para o novo formato com as chaves
Programa simples pra cortar vídeos (7)
Instalação automatizada do Debian 12 em UEFI (1)
Browser/Placa de vídeo trava Ubuntu 22.04 (2)